-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Build: quote the path string for bundle resources #2972
Conversation
@swift-ci please smoke test |
What's the impact on non-Windows? The forward slash is a valid character in filenames on macOS, for example. |
Forward slashes remain as is - this simply escapes backslashes in the path so that it can be embedded into a string. |
We need to ensure that we escape `\` for paths in strings. This enables using bundles for tests on Windows.
@swift-ci please smoke test |
Thanks for fixing this! I agree with Jakes comment and the revised fix looks good. |
Jake, do you still feel that changes are requested here? |
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.
Looks great, thanks Saleem!
stream <<< """ | ||
import class Foundation.Bundle | ||
|
||
extension Foundation.Bundle { | ||
static var module: Bundle = { | ||
let mainPath = Bundle.main.bundlePath + "/" + "\(bundlePath.basename)" |
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 change actually broke the lookup for resource bundles. Since Bundle.main
is now executed inside the swift build
context, mainPath
is now /usr/bin
on linux instead of the location of the output binary.
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.
I've moved the call to Bundle.main
back to the generated code in #3463
We need to ensure that we escape
\
for paths in strings. This enablesusing bundles for tests on Windows.