Consider our package awesomepackage.m
.
If I put this file in FileNameJoin@{$UserBaseDirectory, "Applications"}
I can easily import it in any notebook with a simple Needs["awesomepackage`"]
(or similar command).
The same still works if I put awesomepackage.m
in a subdirectory of Applications, like in FileNameJoin@{$UserBaseDirectory, "Applications","awesomepackage"}
.
However, if for any reason I want my awesomepackage to be in some subsubdirectory of Applications, then I will have to use its full path, otherwise Mathematica will not be able to find it based on the context name alone.
Is there some convenient way to have Mathematica look for .m
files by default in all (sub..)subdirectories of Applications, maybe up to some nested level?
The core idea is that I want to be able to change the exact location of awesomepackage.m
without having to change the way it is imported in all the notebooks, and possibly without having to add some code in every notebook in which I want to import this package.