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

Home » Public Forums » archive » Re: FILEPATH, FILE_MKDIR and portability
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: FILEPATH, FILE_MKDIR and portability [message #26750] Mon, 24 September 2001 05:18 Go to previous message
weitkamp is currently offline  weitkamp
Messages: 33
Registered: October 1998
Member
Thanks for trying on Windows, David. I think this here might be the best way:

IDL> tmpdir = FILEPATH(/TMP,'')
IDL> tmp_subdir = FILEPATH(ROOT=tmpdir, SUBDIRECTORY='subdir', '')

... until word reaches me that it fails on some platform.

Timm

David Fanning <david@dfanning.com> wrote in message news:<MPG.1617c0c052f7733e9896bf@news.frii.com>...

> Timm Weitkamp (weitkamp@esrf.fr) writes:

>

>> Generally using IDL on Unix systems, I thought I'd be nice and try to

>> write my next routine in a way that would allow to run it on other OS

>> families. Now at a certain point in the code, I need to create a

>> scratch subdirectory. In Unix this would be called, say, "/tmp/mydir".

>> Of course in other OSs the name is different. I understand that

>> FILEPATH(/TMP, SUBDIR='mydir', 'myfile') will get me the full path

>> name of a file named "myfile" in such a directory. But to create the

>> directory, I need its name alone.

>>

>> I know that on my Unix or Linux machines, I get a correct result when

>> I do

>>

>> IDL> tmpdir = FILEPATH(/TMP, 'mydir')

>> IDL> FILE_MKDIR, tmpdir

>>

>> But nothing tells me that this will work on just any other operating

>> system, e.g., one that makes a cleaner distinction between files and

>> directories than Unix does. It'd probably work on Windows (though I'd

>> appreciate if someone out there could test and confirm this);

>

> It worked on Windows 2000. The directory is created

> in the the directory pointed to by the TEMP or TMP

> system variables.

>

>> I don't

>> know if it would work on a Mac, and am quite sure it would fail on

>> VMS. So what is the correct general way of creating a directory, if

>> not one that starts with "CASE !VERSION.OS_FAMILY OF ..."?

>

> Don't know. Sometimes there is no way around using

> !Version.

>

>> PS. Also, I wonder if it is a bug or a feature that when using

>> FILEPATH with the keyword TMP, the SUBDIRECTORY keyword does not seem

>> to work:

>>

>> IDL> tmpfile = FILEPATH(/TMP, SUBDIRECTORY='subdir', 'file.dat')

>> IDL> HELP, tmpfile

>> IDL> TMPFILE STRING = '/usr/tmp/file.dat'

>

> Hard to say if it is a bug or feature, but the

> Subdirectory designation does indeed appear to

> be ignored.

>

> Cheers,

>

> David
[Message index]
 
Read Message
Read Message
Previous Topic: Re: Arrow command/ velovect plot resolution... a little more info
Next Topic: Re: Making draw widget areas that are bigger than the screen area

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

Current Time: Wed Oct 08 19:10:13 PDT 2025

Total time taken to generate the page: 0.00465 seconds