-
-
Notifications
You must be signed in to change notification settings - Fork 60
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
It would be good if the script could detect it's running via swift-sh #101
Comments
I tried this initially, unfortunately SwiftPM insists that package sources are below the folder that contains the One (lot of work) solution would be to generate a module that contains path information that can be imported by the script. |
I was wondering about that, the path thing is probably due to the sandboxing. But that was just a suggestion. What the issue is really about is the script knowing that it is running within swift-sh. Then I can adjust the library code not to use the What about this, prepend the copied script with this:
There is a small chance that the import might collide with the script itself, but I suppose it is low. And maybe the feature could be disabled via |
oh yes, env-var is a good solution. We also define PR welcome. |
In fact since we control the output, we could just define a Line numbers will be off as a result unfortunately. But really we should be mangling any compiler error messages anyway. |
let is not good enough because libraries may want to inspect that setting. needs to be more global. |
It seems any library that depends on its location is asking for trouble, but I don’t see any reason to prohibit the env-var solution, so feel free. |
Actually something which would also be really nice if (BTW: The location is for resource lookup and only used during development / quick hacks, on deployment the sources wouldn't be available and it would switch to cwd or an explicit location. The special issue w/ swift-sh is that it does both, drop the source and yet still have them - the original idea was to disable |
While waiting for proper support for this (either |
For an explanation of the issue, see: mxcl/swift-sh#101 Using `_` as suggested to lookup the original invocation location.
A common hack is to use
#filename
to locate resources living alongside the source files. When swift-sh moves the script source to its cache, this doesn't work anymore.Idea: Instead of copying the script itself, could you still point to the original file in the Package.swift, e.g.:
I think that would be very useful regardless?
The text was updated successfully, but these errors were encountered: