Message Boards Message Boards

0
|
6258 Views
|
3 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Package Directory?

You can tell what directory a notebook is in by using NotebookDirectory[ ].
Is there a way of obtaining the directory a loaded package is in?

POSTED BY: Frank Kampas
3 Replies

Thanks for the info. I have a further question: is there code you can put in the package that tells where the package is?

POSTED BY: Frank Kampas

If you want to know in witch directory your current pack is on runtime, you can use $InputFileName This is a problem when you test your code in the notebook, but run your package as a script. To solve this, I use my own function

fileDirectory[]:=If[$InputFileName=="",NotebookDirectory[],DirectoryName[$InputFileName]]

so fileDirectory[] is independent over environment

POSTED BY: Rodrigo Murta

FindFile

POSTED BY: Sean Clarke
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract