Closed sedyh closed 1 year ago
Looks like duplicate for #63 closing this.
There is also provided better solution for this: https://github.com/tslocum/go-tiled/commit/2d2dec486bd90b8c2b88c37a81615cc0e0ac4728
imho it is not correct to use path.Join
feel free to send PR for this
Thats strange... no one has made a fix for the issue since last year. I'l try, if I have time.
I have no windows to test on, so I not really want to implement something I'm not able to even test :]
Problem
Hello, I found a problem in the operation of one of the UnmarshalXML in Map. This code will cause
os.ErrNotExist
on windows fordata/world/surface-tileset.tmx
even if the file is there:The library allows you to insert your own fs implementation to upload files: https://github.com/lafriks/go-tiled/blob/main/tiled.go#L76
In the process, it loads additional files (for example, tileset) for which it builds a path as follows: https://github.com/lafriks/go-tiled/blob/main/tmx_map.go#L173
Which will return the path with windows-like slashes
data\world\surface-tileset.tmx
. This path will not work with embed: https://github.com/golang/go/issues/44305Despite the fact that these are details of the implementation of a specific fs, it is part of the standard library. So it makes sense to take these details into account inside the lib.
Solution A
Add a wrapper that converts paths in special cases.
Solution B
Add the option to use
path.Join
instead offilepath.Join
for special occasions.Looks like it the same as #63.