Re: alias in idl [message #44052] |
Mon, 16 May 2005 15:10  |
Michael Wallace
Messages: 409 Registered: December 2003
|
Senior Member |
|
|
Koh Leong Tah wrote:
> hi all,
> i have a directory which I happen to restore structures on pretty often
> and i was wondering if there's a way to have a shortcut name to that
> directory that i can setup, maybe in .idlinit?
> thanks,
> kl
>
Besides what has already been mentioned, you can also create an
environmental variable with a value of the directory path. Then, in IDL
you can use:
dir = getenv('NAME_OF_ENV_VAR')
Something like this is can be really handy if you give your code to
someone else and they have a different directory structure. Instead of
editing your code or IDL startup files, you only have to create the
appropriate variable. Just another way to skin this cat.
Of course, I'd say to go with the solutions that have already been
offered. Something like this only needs to be used if you want to
distribute your code to others.
-Mike
|
|
|
|
|
Re: alias in idl [message #44144 is a reply to message #44053] |
Tue, 17 May 2005 09:38  |
R.G. Stockwell
Messages: 363 Registered: July 1999
|
Senior Member |
|
|
> Koh Leong Tah wrote:
>
> hi all,
> i have a directory which I happen to restore structures on pretty often
> and i was wondering if there's a way to have a shortcut name to that
> directory that i can setup, maybe in .idlinit?
> thanks,
> kl
All the other suggestions are good. I'd just mention that I find it
quite helpful to have a "configuration" object, with methods such
as "get_datadir", "cd_datadir", "get_workingdir", "cd_workingdir",
"get_winddatadir", "get_tempdatadir", etc.
so that the code is always the same, and if you change directory structure
(such as switching between windows and linux) then the only place you
need make changes is in the configuration file.
In fact, I do a "computer name" check, and return the appropriate path.
Of course, in IDL, it is just as easy to make a procedure (and perhaps have
keywords instead of methods.
Cheers,
bob
|
|
|