heapsTiled icon indicating copy to clipboard operation
heapsTiled copied to clipboard

Clean pull test fails with "File not found cavesofgallet_tiles.tsx"

Open c-g-dev opened this issue 2 years ago • 2 comments

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.

c-g-dev avatar Jun 02 '23 23:06 c-g-dev

hey did you ever fix that error I am having the same issue

SabeDoesThings avatar Sep 17 '23 21:09 SabeDoesThings

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();
		

c-g-dev avatar Sep 20 '23 18:09 c-g-dev