Skip to content

SKSwiftPMWorkspace: canonicalize the path prior to use #324

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

Closed
wants to merge 1 commit into from

Conversation

compnerd
Copy link
Member

@compnerd compnerd commented Oct 5, 2020

Ensure that we use the file system representation for the path as
otherwise the path conversion may fail. This is required for Windows
which ends up with mixed path separators.

Ensure that we use the file system representation for the path as
otherwise the path conversion may fail.  This is required for Windows
which ends up with mixed path separators.
@compnerd compnerd requested a review from benlangmuir as a code owner October 5, 2020 18:13
guard let path = try? AbsolutePath(validating: url.path) else {
return nil
}
guard let path = (url.withUnsafeFileSystemRepresentation {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm surprised this is only needed in one place - why don't we have the same issue for incoming URLs from the editor?

Is there a reason you preferred withUnsafeFileSystemRepresentation instead of standardizedURL.path?

Copy link
Member Author

Choose a reason for hiding this comment

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

Well, this was specifically for the test, I'm sure that I will need to do this a fair amount more as we discover the sites.

The reason for that is mostly because I did this before we had a chat, and I just failed to think about standardizedURL.path, I'll want to change to that and test it, as I think it would be better to use.

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually, thinking more about this, I don't think that standardizedURL.path will do what we want. That will give the path as a URI string rather than the FSR, which means that it cannot be used for the AbsolutePath(validating:) constructor.

@compnerd
Copy link
Member Author

compnerd commented Oct 7, 2020

I am closing this off because I believe that this is not the right approach. I think that the problem is in tools-support-core instead. I believe that swiftlang/swift-tools-support-core#140 takes care of the underlying issue making this work.

@compnerd compnerd closed this Oct 7, 2020
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