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?

FindFile

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

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