Re: How to get the current working directory [message #70101] |
Thu, 11 March 2010 14:21 |
rogass
Messages: 200 Registered: April 2008
|
Senior Member |
|
|
On 11 Mrz., 11:35, "abe...@gmail.com" <abe...@gmail.com> wrote:
> In IDL command line, if I type
>
> CD, C=c & PRINT, c
>
> I get
>
> /home/bert_an
>
> Say I have a routine main.pro under /home/bert_an/MyCode
> so the complete path is /home/bert_an/MyCode/main.pro
>
> Is there a function that while running main.pro gives me the path to
> this file?
> Example:
>
> IDL> print, PathFunction
> /home/bert_an/MyCode
>
> Thank you,
> Andrés
Maybe this works:
Help, Calls=callStack
thispath = strmid(((str=strmid(((c=callstack[0])),((start=strpos(c,'<')
+1)),$
strpos(c,'(')-start))),0,strpos(str,FILE_basename $
(strmid(c,((start=strpos(c,'<')
+1)),strpos(c,'(')-start))))
Cheers,
CR
|
|
|
|
|