Re: Automatically identifying a directory
- To: mathgroup at smc.vnet.net
- Subject: [mg108421] Re: Automatically identifying a directory
- From: "Carl K. Woll" <carlw at wolfram.com>
- Date: Wed, 17 Mar 2010 04:39:31 -0500 (EST)
On 3/16/2010 6:58 AM, Albert Retey wrote: > Am 16.03.2010 10:46, schrieb Will DeBeest: > >> When using notebooks I can use NotebookDirectory[] to return a string >> for the notebook path. Unless I've missed something obvious there >> doesn't appear to be a way of automatically finding directories if you >> are running *.m files remotely from a terminal. Basically I have an >> *.m file and I'd like to have something like MFileDirectory[] so that >> the path is identified when the file is run remotely. It seems simple/ >> obvious. Any ideas? >> > AFAIK there is nothing likte NotebookDirectory for package files. But > you can create something with $Input, FindFile and FileNames. E.g. I > think this should work in many cases: > > FindFile[$Input] > > but it might depend on how you start the .m file so you might need to > experiment to get the desired result. You might also want to look at the > tutorial tutorial/NamingAndFindingFiles for more functions related to > the topic. > > hth, > > albert > > There is System`Private`$InputFileName, but as the name indicates, this functionality may change or be renamed at any time. Carl Woll Wolfram Research