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 #51858 is a reply to message #35617] Thu, 14 December 2006 18:17 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
damonanomad@gmail.com writes:

> 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?

Yeah, I'm not sure what they are thinking with that
example. $HOME is not a standard Windows environment
variable. Perhaps they mean "this is how you would do
it IF you had defined an environment variable named
$HOME." Hard to say.

I think in general you have to know where you are
when you create a file path. If you are sure the
file is located in a known subdirectory (say IMAGES)
of where you are currently located, you might create
a path to an image file like this:

CD, Current=thisDir
filename = Filepath(Root_Dir=thisDir, SubDir='images', 'test.img')

Programs exist that help with this. PROGRAMROOTDIR, for example:

http://www.dfanning.com/programs/programrootdir.pro

Or, you could create your own IDL system variable:

IDL> DefSysVar, '!HOME', 'C:\RSI\COYOTE\TEST'
IDL> filename = Filepath(Root_Dir=!HOME, SubDir='images', 'test.img')

Anyway, a few ideas.

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: Fri Oct 10 14:35:08 PDT 2025

Total time taken to generate the page: 7.11754 seconds