-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
change @__FILE__, @__DIR__, etc. to give right runtime answer #38682
Comments
FWIW, if they use |
True, but |
|
Perhaps we could reserve a special path representation to represent a pkgdir in a path, which becomes an absolute path when calling But closing in favor of #38696, which seems slightly less speculative and relatively straightforward |
As this is the only issue to mention both pkg = Base.identify_package(...)
pkg_dir = dirname(dirname(Base.locate_package(pkg))) # Naive logic here, could be improved for extensions This was used in JuliaTime/TimeZones.jl#479 as a work around |
The best long-term solution is probably something like #56053 |
Currently these macros are expanded at build time to an absolute path based on the source location at build time. This means that any use of them in precompilable packages causes the resulting
.ji
files to be non-relocatable. It also means that any use of them in a stdlib will break the resulting Julia sysimg by causing it to be non-relocatable. I would propose that instead of expanding to a static path, these macros be changed to expand to code that will give the correct path at runtime. This is a technically breaking change, but I suspect that 99% of uses won't notice and changing this will silently make people's code do what they thought it was doing already.The text was updated successfully, but these errors were encountered: