heapsTiled
heapsTiled copied to clipboard
Clean pull test fails with "File not found cavesofgallet_tiles.tsx"
Cloning the repo and running the test fails with "File not found cavesofgallet_tiles.tsx". The same error happens when importing the library to other projects.
The issue is that the filepath is having a leading "/" at TMap:223 and TMap:227 if the resources are in the base path.
I fixed this locally by changing TMap to simply remove leading slashes from file names. I would raise a PR but I'm not sure if this is some kind of OS specific file system issue. I am running on Windows.
hey did you ever fix that error I am having the same issue
hey did you ever fix that error I am having the same issue
Like I said above I fixed this locally by changing TMap to simply remove leading slashes from file names. You'll need to crack open the file in your haxelib directory and manually fix it, but then it should work out of the box. I included the line numbers where the fix needs to be made above.
Here is what I did:
private function removeLeadingSlash(path: String): String {
if(path.indexOf("/") == 0){
return path.substring(1, path.length);
}
return path;
}
...
var file = try hxd.Res.load(removeLeadingSlash(folder+fileName))
catch(e:Dynamic) throw "File not found "+fileName;
var xml = new haxe.xml.Access( Xml.parse(file.entry.getText()) ).node.tileset;
var tile = hxd.Res.load(removeLeadingSlash(file.entry.directory + "/" +xml.node.image.att.source)).toTile();