Skip to content

Comments

fix: use backslash for path on windows#50

Closed
wenym1 wants to merge 1 commit intodtolnay:masterfrom
wenym1:fix-windows
Closed

fix: use backslash for path on windows#50
wenym1 wants to merge 1 commit intodtolnay:masterfrom
wenym1:fix-windows

Conversation

@wenym1
Copy link

@wenym1 wenym1 commented May 14, 2024

In PR tokio-rs/tokio#6558, I was trying to use rustversion.

But it fails the CI on windows-latest due to the following error.

couldn't read \\?\D:\a\tokio\tokio\target\debug\build\rustversion-2d44b26e828f2c8d\out/version.expr: The filename, directory name, or volume label syntax is incorrect. (os error 123)

This is because currently the version is loaded from a path with fixed / as path separator, but on windows the path separator should be \.

In this PR, we will change to use \ as path separator for windows.

In a separate CI run that uses the commit patched from this PR, the test passes.

Copy link
Owner

@dtolnay dtolnay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

As is, this change would break cross-compilation from non-Windows to Windows because target_os = "windows" would be true in that case but \ paths do not make sense on the non-Windows host. I put up #51 with an implementation that decides the path separator based on the host platform, rather than the target platform.

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 this pull request may close these issues.

2 participants