Feature request: Support for Absolute Includes w.r.t. the project root.
This is not an issue, it's rather a feature request.
When having a larger project, I think we shall have the possibility to use absolute paths with respect to the root of the project. See the following project structure: core ---dir1 ------subdir1 ---------file1.jl ---dir2 ------subdir2 ---------file2.jl
In file2.jl it is ugly to have an include like: @from "../../dir1/subdir1/file1.jl". The number of "../" can be much longer. Instead we shall have @from "core/dir1/subdir1/file1.jl".
That implies the use of some Environment Variable and add the folder containing "core" to it. Can we use JULIA_LOAD_PATH for this purpose?
FWIW I personally prefer the ..-based syntax, but I know that's not universal.
Anyway, I think this should be simple enough to do without any environment variables or anything. Something like the following:
macro fromroot(path::String, ex::Expr)
root = Base.moduleroot(__module__)
basepath = dirname(pathof(root))
path = joinpath(basepath, path)
return quote @from $path $ex end
end
## file2.jl
@fromroot "core/dir1/subdir1/file.jl" import foo
(untested)
Give it a try and see if it works? This seems like a reasonable thing to want so I think I'd be happy to accept a PR on this.