Where should I put a preferences file? [message #13428] |
Fri, 13 November 1998 00:00  |
Liam Gumley
Messages: 473 Registered: November 1994
|
Senior Member |
|
|
I have an IDL application in which it would be useful to store a
preferences file for each session. For example, this would allow the
application to remember the last 4 data files loaded.
On a Unix system, the name and location for this file would be something
like
"$HOME/.idlapp"
However my application needs to run on Windows and Macintosh systems as
well. Is there a standard file name/location I can use on Win and Mac
systems?
Cheers,
Liam.
---
Liam E. Gumley
Space Science and Engineering Center, UW-Madison
1225 W. Dayton St., Madison WI 53706, USA
Phone (608) 265-5358, Fax (608) 262-5974
http://cimss.ssec.wisc.edu/~gumley
|
|
|
Re: Where should I put a preferences file? [message #13506 is a reply to message #13428] |
Sat, 14 November 1998 00:00  |
Martin Schultz
Messages: 515 Registered: August 1997
|
Senior Member |
|
|
J.D. Smith wrote:
> Liam Gumley wrote:
>>
>> I have an IDL application in which it would be useful to store a
>> preferences file for each session. For example, this would allow the
>> application to remember the last 4 data files loaded.
>> [...]
How about looking for the IDL startup file (providing you use an identical
name like idl_startup.pro everywhere -- or you query getenv('IDL_STARTUP'))
and put your preferences file in that same directory. I always dislike
cluttering my $HOME directory with "selfmade" files, and assuming a
hard-wired directory name for any users' IDL applications seems risky, too.
If you wish, you can download file_exist.pro and extract_path.pro from my web
page (see below); the first retrieves the fully qualified path for a file in
a list of directories (just pass !PATH here, so it will automatically be
platform dependent [pun intended]), and the latter cuts out the directory
portion of that full path. But you'll probably have something like this on
your own ...
Regards,
Martin.
--
------------------------------------------------------------ -------
Dr. Martin Schultz
Department for Engineering&Applied Sciences, Harvard University
109 Pierce Hall, 29 Oxford St., Cambridge, MA-02138, USA
phone: (617)-496-8318
fax : (617)-495-4551
e-mail: mgs@io.harvard.edu
Internet-homepage: http://www-as.harvard.edu/people/staff/mgs/idl/
------------------------------------------------------------ -------
|
|
|
Re: Where should I put a preferences file? [message #13525 is a reply to message #13428] |
Fri, 13 November 1998 00:00  |
J.D. Smith
Messages: 214 Registered: August 1996
|
Senior Member |
|
|
Liam Gumley wrote:
>
> I have an IDL application in which it would be useful to store a
> preferences file for each session. For example, this would allow the
> application to remember the last 4 data files loaded.
>
> On a Unix system, the name and location for this file would be something
> like
>
> "$HOME/.idlapp"
>
> However my application needs to run on Windows and Macintosh systems as
> well. Is there a standard file name/location I can use on Win and Mac
> systems?
>
> Cheers,
> Liam.
>
> ---
> Liam E. Gumley
> Space Science and Engineering Center, UW-Madison
> 1225 W. Dayton St., Madison WI 53706, USA
> Phone (608) 265-5358, Fax (608) 262-5974
> http://cimss.ssec.wisc.edu/~gumley
I always use !DIR + sep + 'this_pref' where sep is defined correctly '\
or :'. For unix I usually use getenv('HOME')+'/'+'.this_pref'. Since
IDL includes no intrinsic (read portable) way to create directories, you
must use the one included by default in all IDL sessions. This can get
to be bothersome for a large collection of preference files, and
therefore it seems that the ability for IDL to create and check on the
existence of directories in a system-generic way would be valuable.
JD
--
J.D. Smith |*| WORK: (607) 255-5842
Cornell University Dept. of Astronomy |*| (607) 255-6263
304 Space Sciences Bldg. |*| FAX: (607) 255-5875
Ithaca, NY 14853 |*|
|
|
|