-
Notifications
You must be signed in to change notification settings - Fork 129
various hacks for paths on Windows #114
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
Conversation
CC: @egorzhdan |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks reasonable to me as short-term workarounds until we can get path support from another package. I am not familiar with the Windows calls, so have looked at this mostly from the perspective of how it would affect other platforms.
One possible nuance to watch out for: storing Windows path separators in the native representation makes sense, but if there's any code that compares the path string to a string it read in from an input file (e.g. manifest) that uses forward separators, that comparison might now fail. In those cases, that code should create two paths and then compare them, so I don't think this change is wrong, but it's just something to keep in mind if there turns out to be fallout on Windows.
1290a2d
to
7dfa8cf
Compare
@swift-ci please test |
} | ||
|
||
// FIXME: We should investigate if it would be more efficient to instead | ||
// return a path component iterator that does all its work lazily, moving | ||
// from one path separator to the next on-demand. | ||
// | ||
var components: [String] { | ||
#if os(Windows) | ||
return string.components(separatedBy: "\\").filter { !$0.isEmpty } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technically, this should use PathSkipRootW
and then split on \
and /
.
7dfa8cf
to
75fe760
Compare
This is sufficient for bootstrapping s-p-m on Windows, although the long term maintainable solution is to migrate towards Swift System.
75fe760
to
150fbc6
Compare
@swift-ci please test |
I still dislike this, but this should hopefully unblock the work necessary to support Windows. Discussed offline with @abertelrud and @neonichu about using this as a crutch for the time being to enable us to more rapidly support Windows. |
This is sufficient for bootstrapping s-p-m on Windows, although the long
term maintainable solution is to migrate towards Swift System.