how to set path? [message #25223] |
Wed, 23 May 2001 04:35  |
web
Messages: 24 Registered: March 2001
|
Junior Member |
|
|
Hi, I'd like to know how to set path in IDL. For example, my idl program is
in some directory. In the program, some datafile will be input. If I donot
set whole path including the directory, there is a falt indicating that the
data file cannot be found in rsi\idl. I hope that all the file in the same
directory as idl program will not indict whole path. How to do that? thanks!
|
|
|
Re: how to set path? [message #25289 is a reply to message #25223] |
Wed, 30 May 2001 07:10  |
Dave Greenwood
Messages: 33 Registered: October 2000
|
Member |
|
|
"web" <jiali3@21cn.com> wrote:
> Thank you.
> All the other files are in the same directory with sav file. How to get the
> path? I try to use
> path=FILEPATH('test.pro'), to get the full path,
> but failed. Are there any some function to do this?
I use the following code to determine the location of a .sav file
(courtesy of a source within RSI):
HELP, CALLS = calls
thisroutine = (STRSPLIT(calls[0], ' ', /EXTRACT))[0]
source = ROUTINE_INFO(thisroutine, /SOURCE)
CASE STRUPCASE(!version.os_family) of
'WINDOWS' : dirsep = '\'
'UNIX' : dirsep = '/'
'MACOS' : dirsep = ':'
'VMS' : dirsep = ']'
ELSE : dirsep = ''
ENDCASE
path = STRMID(source.path, 0, STRPOS(source.path, dirsep, /REVERSE_SEARCH))
Dave
--------------
Dave Greenwood Email: Greenwoodde@ORNL.GOV
Oak Ridge National Lab %STD-W-DISCLAIMER, I only speak for myself
|
|
|
Re: how to set path? [message #25290 is a reply to message #25223] |
Wed, 30 May 2001 02:14  |
web
Messages: 24 Registered: March 2001
|
Junior Member |
|
|
Thank you.
All the other files are in the same directory with sav file. How to get the
path? I try to use
path=FILEPATH('test.pro'), to get the full path,
but failed. Are there any some function to do this?
Best
Jiali
"Michael W Asten" <masten@mail.earth.monash.edu.au> wrote in message
news:3B12F6BC.915FBB91@mail.earth.monash.edu.au...
> I had a similar problem recently, to do with use of sav files.
> When you make a sav file with save, /all , the path is also saved.
When the
> sav file is read on another computer, the path in the sav file becomes the
path,
> replacing whatever path you might think the new computer has. This can
give
> rise to the "sometimes works, sometimes does not" problem. Check the path
with
> the command
> print, !path and see if it what it is meant to be.
>
> Regards,
> Michael Asten
|
|
|