Re: file_expand_path [message #51860 is a reply to message #35617] |
Thu, 14 December 2006 16:36   |
damonanomad
Messages: 2 Registered: December 2006
|
Junior Member |
|
|
First off, thanks for the fast reply, David. I didn't get back to IDL
until today.
> if your current
> working directory is C:\somewhere, then when you
> execute the function you get this:
>
> IDL> Print, File_Expand_Path('foo.pro')
> C:\somewhere\foo.pro
>
> This is true whether foo.pro exists or not! (This
> is basically the way FILEPATH works, but perhaps the
> name of this function doesn't disappoint you with inflated
> expectations.)
This is a surprising result to me. It appears, then, that
File_expand_path is basically equivalent to "pwd" in linux, with the
exception that it tacks on a file name that may or may not be in that
current working directory. Strange.
> You will have to get into the directory where the file exists
> before you execute the command:
>
> IDL> CD, 'fieldinfo'
> IDL> Print, File_Expand_Path('full28field.table')
> C:\DocSet\MyDoc\IDL\working\FieldInfo\full28field.table
>
I guess that the short answer is that the file_expand_path function
will not do what I had hoped (give the path of a file in some "unknown"
sub-directory of my working directory). In looking at the online help
index some, I think that file_search may be more suited to what I am
trying to do. However, when I try to use it following one of their
examples (#6):
Result = FILE_SEARCH('$HOME', '*', /EXPAND_ENVIRONMENT,
/TEST_DIRECTORY)
Result has nothing in it although there are sub-directories and
sub-sub-directories in my working directory. Is '$HOME' not the
working directory in windows?
Damon
|
|
|