lime icon indicating copy to clipboard operation
lime copied to clipboard

rootPath-related improvements

Open chatziko opened this issue 4 years ago • 2 comments

This PR includes the following rootPath-related improvements:

  • For pak libraries, / is always appended to rootPath, even it already ends with / (which is the case of rootPath's default value ./). This leads to the pak URL containing double //, which web servers might or might not serve correctly. The PR fixes this via Path.join.

  • In ManifestResources there are various instances of rootPath + <some path> which fail if rootPath does not end with /. The PR appends a / in such case (it might be preferable to use Path.join everywhere, but I wanted to keep the changes minimal).

chatziko avatar Jan 27 '21 13:01 chatziko

I considered suggesting Path.addTrailingSlash(), but I don't know if it's worth importing Path just for that. Honestly it looks good to me the way it is.

player-03 avatar Mar 29 '21 09:03 player-03

I added a commit to help resolve the double-slash issue:

https://github.com/haxelime/lime/commit/105cc69cb7d9f495f5a353a3359f4436f3519e8c

Always adding a slash to root path will cause trouble, particularly on Android which does not resolve paths as well as a standard file system. "myfile.png" and "/myfile.png" are not the same. It may be helpful to discuss in what cases this is failing

jgranick avatar Jul 23 '21 16:07 jgranick

Huh, the web UI didn't allow me to customize the commit message. I would've added that I cleaned up a bit in the process of merging. No need to use StringTools.endsWith("/") when Path.addTrailingSlash() checks both types of slash.

player-03 avatar Sep 03 '22 19:09 player-03