Skip to content

Tests: improve native path representation #940

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

Merged
merged 1 commit into from
Dec 20, 2021

Conversation

compnerd
Copy link
Member

Rather than hardcoding the paths and the path separator, we now compute
the actual locations to ensure that we can correctly represent the path
representation natively on the target. This enables the correct
representation on Windows.

Rather than hardcoding the paths and the path separator, we now compute
the actual locations to ensure that we can correctly represent the path
representation natively on the target.  This enables the correct
representation on Windows.
@compnerd
Copy link
Member Author

@swift-ci please test

@@ -27,6 +27,14 @@ private func executableName(_ name: String) -> String {
#endif
}

private func rebase(_ arc: String, at base: AbsolutePath) -> String {
Copy link
Member Author

Choose a reason for hiding this comment

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

If you have a better name for this function, please suggest it. I'm not tied to it, but this was the best I could come up with.

@compnerd
Copy link
Member Author

@cltnschlosser @artemcm - I'd like to get this merged as it unblocks another set of changes.

Copy link
Contributor

@cltnschlosser cltnschlosser left a comment

Choose a reason for hiding this comment

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

This change is needed because, Windows needs the drive letter for it to be a valid absolute path?

@compnerd
Copy link
Member Author

This change is needed because, Windows needs the drive letter for it to be a valid absolute path?

Correct. The Unix absolute path /foo/bar is interpreted as \foo\bar which is a drive relative path. We compute the absolute path by taking the current drive and appending that relative path to it. This gives us an absolute path.

@compnerd compnerd merged commit 8d8b47f into swiftlang:main Dec 20, 2021
@compnerd compnerd deleted the path-repr branch December 20, 2021 19:40
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.

3 participants