tilde file names in FINDFILE [message #10013] |
Fri, 26 September 1997 00:00  |
Martin Schultz
Messages: 515 Registered: August 1997
|
Senior Member |
|
|
Hi everyone,
I am still using IDL 4 and AIX 3.2.5, but that shouldn't really matter
for the following question, I suppose:
When I am opening a file with
OPENR,unit,'~/IDL/DATA/test.dat',/get_lun
it works fine. But if I try to find that file via
PRINT,FINDFILE('~/IDL/DATA/test.dat')
I get an empty string indicating that IDL did not find it.
Does anyone know how to teach IDL to accept the '~' in FINDFILE ?
One option might be to use SPAWN,'echo $HOME',result but
(a) is this highly OS dependent
(b) does it not work for something like ~user/file.dat
Any ideas appreciated !
Martin Schultz
------------------------------------------------------------ ---------
Dr. Martin Schultz
Department of Earth&Planetary Sciences, Harvard University
186 Pierce Hall, 29 Oxford St
Cambridge, MA 02138, USA
e-mail : mgs@io.harvard.edu
idl web page: http://www-as.harvard.edu/people/staff/mgs/idl/
------------------------------------------------------------ ---------
|
|
|
Re: tilde file names in FINDFILE [message #10073 is a reply to message #10013] |
Thu, 02 October 1997 00:00  |
Martin Schultz
Messages: 515 Registered: August 1997
|
Senior Member |
|
|
William Thompson wrote:
>
> Martin Schultz <mgs@io.harvard.edu> writes:
>
>> Hi everyone,
>
>> I am still using IDL 4 and AIX 3.2.5, but that shouldn't really matter
>> for the following question, I suppose:
>
>> When I am opening a file with
>> OPENR,unit,'~/IDL/DATA/test.dat',/get_lun
>> it works fine. But if I try to find that file via
>> PRINT,FINDFILE('~/IDL/DATA/test.dat')
>> I get an empty string indicating that IDL did not find it.
>
>> Does anyone know how to teach IDL to accept the '~' in FINDFILE ?
>> One option might be to use SPAWN,'echo $HOME',result but
>> (a) is this highly OS dependent
>> (b) does it not work for something like ~user/file.dat
>> Any ideas appreciated !
>
> This routine should do the trick, thanks to my colleague Dominic Zarro.
>
[... cut]
Thanks !
Actually, I received an e-mail suggesting to use the
expand_path() function, and this works, too. You can check routine
file_exist on my website (http below) how I use it now.
Thanks again, anyway,
Martin.
------------------------------------------------------------ ------------Dr.
Martin Schultz
Department for Earth&Planetary Sciences, Harvard University
186 Pierce Hall, 29 Oxford St., Cambridge, MA-02138, USA
phone: (617)-496-8318
fax : (617)-495-9837
Please indicate name and room (186 Pierce) when sending a fax
e-mail: mgs@io.harvard.edu
IDL-homepage: http://www-as.harvard.edu/people/staff/mgs/idl/
------------------------------------------------------------ ------------
|
|
|