How to get the current working directory

  • Follow


In IDL command line, if I type

CD, C=3Dc & 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=E9s
0
Reply aberte 3/11/2010 10:35:00 AM

On Thu, 11 Mar 2010 02:35:00 -0800 (PST), "aberte@gmail.com"
<aberte@gmail.com> wrote:

>Is there a function that while running main.pro gives me the path to
>this file?

http://www.dfanning.com/programs/programrootdir.pro
0
Reply Wox 3/11/2010 12:12:12 PM


aberte@gmail.com schrieb:
> 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

Hi


result=get_profile_path()

http://www.fz-juelich.de/icg/icg-1/idl_icglib/idl_source/idl_html/dbase/get_profile_path_dbase.pro.html

cheers
Reimar
0
Reply Reimar 3/11/2010 2:36:12 PM

On 11 Mrz., 11:35, "abe...@gmail.com" <abe...@gmail.com> wrote:
> In IDL command line, if I type
>
> CD, C=3Dc & 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=E9s

Maybe this works:

Help, Calls=3DcallStack
thispath	=3D	strmid(((str=3Dstrmid(((c=3Dcallstack[0])),((start=3Dstrpos(c,=
'<')
+1)),$
				strpos(c,'(')-start))),0,strpos(str,FILE_basename $
                               (strmid(c,((start=3Dstrpos(c,'<')
+1)),strpos(c,'(')-start))))

Cheers,

CR
0
Reply chris 3/11/2010 10:21:55 PM

3 Replies
1003 Views

(page loaded in 0.081 seconds)

Similiar Articles:













7/21/2012 10:45:22 PM


Reply: