raddleverse / MimiCIAM.jl

MIT License
2 stars 1 forks source link

Relative Paths in Package #16

Closed cledna closed 4 years ago

cledna commented 4 years ago

I noticed that the relative paths don't seem to work properly when the model is run as a package. E.g when I type: MimiCIAM.get_model() I get the following error:

Screen Shot 2019-12-09 at 1 21 29 PM

It seems to suggest that the scripts are calling the paths relative to the user's location, rather than the source file's location. Any thoughts on how to fix this @lrennels ?

cledna commented 4 years ago

Fixed by modifying paths to be of the form joinpath(dirname(pathof(MimiCIAM)), '../data')

davidanthoff commented 4 years ago

Relative paths should just work for include statements, but not for any other file loading stuff.

For file loading, the best way to express things is joinpath(@__DIR__, "..", "data") for example. @__DIR__ returns the full path of the file where it is written, and then the rest is probably clear.