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

Home » Public Forums » archive » Re: UNIX v. Windows Filepaths
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: UNIX v. Windows Filepaths [message #35733] Thu, 10 July 2003 14:12
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
Mark Hadfield wrote:
>
> "Paul van Delst" <paul.vandelst@noaa.gov> wrote in message
> news:3F0D9297.45974B4B@noaa.gov...
>> Wot about summat like:
>>
>> CASE STRUPCASE( !VERSION.OS_FAMILY ) OF
>> 'WINDOWS': DirSeparator = '\'
>> 'MAC': DirSeparator = whatever the Mac directory separator is
>> ELSE DirSeparator = '/' ; Default to Unix
>> ENDCASE
>>
>> CD_Dir = '..'+DirSeparator+'source'
>> CD, CD_Dir, current=currdir
>
> Function PATH_SEP in the standard library returns the appropriate path
> delimiter for the current platform.
>
> Only since 5.5 though.

Well there ya go. I should actually read the "What New in IDL X.X" documents.....

:o)

paulv

--
Paul van Delst
CIMSS @ NOAA/NCEP/EMC
Ph: (301)763-8000 x7748
Fax:(301)763-8545
Re: UNIX v. Windows Filepaths [message #35735 is a reply to message #35733] Thu, 10 July 2003 13:24 Go to previous message
Mark Hadfield is currently offline  Mark Hadfield
Messages: 783
Registered: May 1995
Senior Member
"Paul van Delst" <paul.vandelst@noaa.gov> wrote in message
news:3F0D9297.45974B4B@noaa.gov...
> Wot about summat like:
>
> CASE STRUPCASE( !VERSION.OS_FAMILY ) OF
> 'WINDOWS': DirSeparator = '\'
> 'MAC': DirSeparator = whatever the Mac directory separator is
> ELSE DirSeparator = '/' ; Default to Unix
> ENDCASE
>
> CD_Dir = '..'+DirSeparator+'source'
> CD, CD_Dir, current=currdir

Function PATH_SEP in the standard library returns the appropriate path
delimiter for the current platform.

Only since 5.5 though.

--
Mark Hadfield "Ka puwaha te tai nei, Hoea tatou"
m.hadfield@niwa.co.nz
National Institute for Water and Atmospheric Research (NIWA)
Re: UNIX v. Windows Filepaths [message #35736 is a reply to message #35735] Thu, 10 July 2003 12:32 Go to previous message
JD Smith is currently offline  JD Smith
Messages: 850
Registered: December 1999
Senior Member
On Thu, 10 Jul 2003 07:58:09 -0700, Justin Sieglaff wrote:

> Hi everyone....
>
> A quick question. I've created code and after it is installed on a
> user's machine I want to make the current directory one of the
> directories included with the code. For UNIX I've added the following
> code:
>
> CD, '../source', current=currdir
>
> Since I have never used IDL for Windows I'm not sure how to add a line
> for Windows path. Any help would be greatly appreciated!
>

I use an altogether different method to accomplish the same thing,
which never requires any specific knowledge about the path delimiters,
etc.:

source=(routine_info('irs_calib_dir_marker',/SOURCE)).PATH
dir=strmid(source,0,strpos(source,path_sep(),/REVERSE_SEARCH ))

where the procedure `irs_calib_dir_marker' exists in the directory I'm
after. You can either use an empty marker procedure, or an actual
procedure. The advantage of this method is that your run-time
required data or directory will be found with the associated routine
independent of how IDL was started, and even if the user has severely
butchered the file structure of your distribution (moving various
directories around, say).

You can also create directories or files relative to this in a
platform-independent way using, e.g.:

file=filepath(ROOT_DIR=cdir,SUBDIR='my_data',file)

JD
Re: UNIX v. Windows Filepaths [message #35739 is a reply to message #35736] Thu, 10 July 2003 09:21 Go to previous message
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
Haje Korth wrote:
>
> Just replace '/' with '\'.
>
> Haje
>
> --
>
> "Justin Sieglaff" <justins@ssec.wisc.edu> wrote in message
> news:9bc4f51c.0307100658.56f63b79@posting.google.com...
>> Hi everyone....
>>
>> A quick question. I've created code and after it is installed on a
>> user's machine I want to make the current directory one of the
>> directories included with the code. For UNIX I've added the following
>> code:
>>
>> CD, '../source', current=currdir
>>
>> Since I have never used IDL for Windows I'm not sure how to add a line
>> for Windows path. Any help would be greatly appreciated!
>>
>> Thanks,
>>
>> Justin


Wot about summat like:

CASE STRUPCASE( !VERSION.OS_FAMILY ) OF
'WINDOWS': DirSeparator = '\'
'MAC': DirSeparator = whatever the Mac directory separator is
ELSE DirSeparator = '/' ; Default to Unix
ENDCASE

CD_Dir = '..'+DirSeparator+'source'
CD, CD_Dir, current=currdir

??

paulv

p.s. I didn't check the syntax. And !VERSION.OS_FAMILY might not be the value you need,
but you get the idea.

--
Paul van Delst
CIMSS @ NOAA/NCEP/EMC
Ph: (301)763-8000 x7748
Fax:(301)763-8545
Re: UNIX v. Windows Filepaths [message #35740 is a reply to message #35739] Thu, 10 July 2003 08:43 Go to previous message
Haje Korth is currently offline  Haje Korth
Messages: 651
Registered: May 1997
Senior Member
Just replace '/' with '\'.

Haje

--


"Justin Sieglaff" <justins@ssec.wisc.edu> wrote in message
news:9bc4f51c.0307100658.56f63b79@posting.google.com...
> Hi everyone....
>
> A quick question. I've created code and after it is installed on a
> user's machine I want to make the current directory one of the
> directories included with the code. For UNIX I've added the following
> code:
>
> CD, '../source', current=currdir
>
> Since I have never used IDL for Windows I'm not sure how to add a line
> for Windows path. Any help would be greatly appreciated!
>
> Thanks,
>
> Justin
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: User Functions for ENVI
Next Topic: IDL 6.0 Seminar Series

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

Current Time: Wed Oct 08 15:37:15 PDT 2025

Total time taken to generate the page: 0.00984 seconds