Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non portable paths issue #24

Open
nbigaouette-eai opened this issue Jan 17, 2019 · 0 comments · May be fixed by #25
Open

Non portable paths issue #24

nbigaouette-eai opened this issue Jan 17, 2019 · 0 comments · May be fixed by #25

Comments

@nbigaouette-eai
Copy link

I had an issue with milksnake when setuping a CI pipeline for Linux, Mac and Windows.

For Windows I SET the CARGO_TARGET_DIR to a folder I can cache between runs. To prevent issue with Windows backslash being wrongly escaped (or not), I use a path similar to C:/cargo_cache/project_name/target.

After some debugging, I've realized that milksnake assumes / is used as paths separators when looking for files. See for example

path = os.path.join(path, *in_path.split('/'))

and

path = os.path.join(path, *in_path.split('/'))

Those two lines will join() the search path with the in_path argument which is split with forward slashes.

I thus end up with paths that look like C:cargo_cache/project_name/target and milksnake can't find the expected files.

It seems those lines attempt to replace the forward slashes with the platform's separator, but it's not doing a proper job.

If that is the expected behaviour, I would suggest doing something like that instead:

path = os.path.join(os.path.normalize(path), *os.path.normalize(in_path).split(os.sep))

or even just

path = os.path.join(os.path.normalize(path), os.path.normalize(in_path))

or maybe even simpler

path = os.path.normalize(os.path.join(path, in_path))
@nbigaouette nbigaouette linked a pull request Jan 20, 2019 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant