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

Home » Public Forums » archive » Re: current directory
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: current directory [message #34298 is a reply to message #34297] Sat, 01 March 2003 06:51 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Ulf-Dietrich Braumann (braumann@izbi.uni-leipzig.de) writes:

> I wonder if there is some elegant way in IDL to
> i) determine the directory where the current running *.pro file
> is stored in order to
> ii) directly access some other stuff (i.e. images) just placed
> in the same directory as the "calling" *.pro

I'm not exactly sure what you are asking for. You
can certainly determine the name of the program
module that you are currently in, and the name
of the program module that called you.

And you can find the "default" location of the
current module you are in by using File_Which.
But I don't think IDL keeps track of which of the
10 files you have named "junk.pro" is currently the
compiled one. In other words, you can find out
which of those 10 junk.pro files would be called
if you opened up an IDL session and typed "junk",
but you can't determine which of the 10 is actually
being used in that IDL session.

I suppose this can be good news or bad news depending
upon what you are trying to do here. :-)

But here is some code that gets you as far as you
can get to:

;****************************************************
PRO Tester
Help, Calls=callStack
thisRoutine = (Str_Sep(StrCompress(callStack[0])," "))[0]
callingRoutine = (Str_Sep(StrCompress(callStack[1])," "))[0]
Print, 'In ' + thisRoutine + ', which is called by ' +
callingRoutine + '.'
thisRoutine = StrLowCase(thisRoutine) + '.pro'
thePath = File_Which(thisRoutine, /Include_Current)
thePath = StrMid(thePath, 0, StrPos(thepath, thisRoutine))
Print, 'The default path to ' + thisRoutine + ' is: ' + thePath
END
;****************************************************

Called like this:

IDL> tester

It produces this output:

In TESTER, which is called by $MAIN$.
The default path to tester.pro is: C:\IDL\DAVID\

Cheers,

David
--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: dynamically naming variables
Next Topic: dlm returning ptr array and string array

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

Current Time: Sat Oct 11 09:06:39 PDT 2025

Total time taken to generate the page: 0.80220 seconds