I have a mathematica .m file that I am running on the command line (as well as in the IDE for debugging).
I want to get the path that it is run from so that I can store output files relative to it. It seems that if I run the file from the command line that $InitialDirectory gives me what I want, but when I Right-Click Open on my desktop to view it in the Mathematica IDE, $InitialDirectory gives me something else.....
It looks like there is a function called NotebookDirectory[] which works for .nb's, but not for .m's....
Is there any trick to do the equivalent for .m?
Thanks,
Jesse