rust-embed icon indicating copy to clipboard operation
rust-embed copied to clipboard

Debug builds more lenient when loading relative paths

Open 949f45ac opened this issue 1 year ago • 0 comments

Hey there, cool library that is working very well for me!

I only ran into one confusing corner case. When loading paths that have (silly) inner relative segments, like foo/bar/baz/../../other, the debug loader will happily resolve and load this path from disk. The bundled (release) loader though will fail, presumably because each bundled file is only mapped to its canonical path string. I think the bundled loader’s behavior is very sensible - it would only be nice if the debug loader also failed to load these relative paths. Or at least printed a fat warning that it would have failed to resolve that path in the release build.


After figuring out the cause for my release build’s issue, I solved it by using https://github.com/danreeves/path-clean on the paths before passing them to rust_embed, which is simple enough. I think it’s sensible that rust_embed doesn’t do this automatically. My feature request is only that the debug builds should also fail.

949f45ac avatar Dec 21 '23 08:12 949f45ac