dtolnay / rustversion

Conditional compilation according to rustc compiler version
Apache License 2.0
336 stars 15 forks source link

fix: use backslash for path on windows #50

Closed wenym1 closed 6 months ago

wenym1 commented 6 months ago

In PR https://github.com/tokio-rs/tokio/pull/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.