comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » FILE_EXPAND_PATH
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: file_expand_path [message #51898 is a reply to message #35617] Tue, 12 December 2006 16:11 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
damonanomad@gmail.com writes:

> I am trying to to use IDL and have run into some a strange behavior
> in 6.2 using file_expand_path. The following lines illustrate what I
> am seeing:
>
> IDL> file_a=file_expand_path('full28field.table')
> IDL> print, file_a
> C:\DocSet\MyDoc\IDL\working\full28field.table
> IDL> print, file_test(file_a)
> 0
> IDL> file_b='C:\DocSet\MyDoc\IDL\working\FieldInfo\full28field.ta ble'
> IDL> print, file_test(file_b)
> 1
>
> As can be seen above, the path that it is returning is not the true
> path of the file but I don't know why it isn't.

Probably because that function doesn't try to determine
the "true path" of the file. It just "builds" a path
from wherever you happen to be located at the moment
you execute the function. That is, 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.)

> The search path that I
> have set in "Preferences" (in addition to default) is
> 'C:\DocSet\MyDoc\IDL' and its sub-directories. (note that
> '\DocSet\MyDoc' = '\Documents and Settings\user\My Documents' in
> reality)
> Any ideas out there why I am running into this problem? Suggestions
> would be greatly appreciated.

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

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Zipped Files
Next Topic: Capturing a screenshot in IDL

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 16:51:53 PDT 2025

Total time taken to generate the page: 0.00447 seconds