Path to project

Hi good folks!

I have tried googling for this for about 4 hours now. How do I get the base path to the current project (that is not a module) in Julia?

Thanks!

Does the below do what you want? It returns the file path of the Project.toml file of the active project.

julia> Base.active_project()
2 Likes

Thanks! That gets me part of the way! By the way, is there any good guide on how to use includes of relative paths within a file structure/project?

Just using pure relative paths in includes uses the current working dir as base path but more useful would be to have a project fixed path as base path, right?

In files you can use something like joinpath(@__DIR__, "../rel/a/tive/path"), see Essentials · The Julia Language.

1 Like