I get get notebook location with NotebookDirectory\[\]
How to get m-file location from within it?
Mathematica Stack Exchange is a question and answer site for users of Wolfram Mathematica. It only takes a minute to sign up.
Sign up to join this communityYou can use
DirectoryName[$InputFileName]
packDir[] := DirectoryName[$InputFileName]
in the package, then try to use packDir[]
after the package has already loaded. Instead, do $packDir = DirectoryName[$InputFileName]; packDir[] := $packDir
in the package.
$\endgroup$
FileNames["*.m", NotebookDirectory[]]
? $\endgroup$