[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Creating Directories



Trond Trondsen wrote:

> The solutions presented in this thread all seem to be unacceptable
> in view of the fact that IDL is, in principle, platform independent.
> I was contracted to write a piece of widget software that is supposed
> to run under unix/linux (the only platform *I* am able to stomach),
> VMS, Mac, as well as MS-Win/99 (or whatever it's called now). I happen to need
> to create subdirectories recursively and so on -- so, if I may ask,
> where is the IDL command to do directory creation platform independently.
> Independent like FILEPATH, for example. If I had direct access to all the
> different platforms I could of course easily write my own function using
> the !VERSION system variable. Let me know if anybody comes up with a
> CREATEDIR command for IDL.  :-)  -trond
>

This may not be the "perfect and complete" answer, but what I do to run a program
on different platforms is to use a batch file which defines the common blocks
(oh, yes I use common blocks!) and defines the platform specific path names,
directory separators etc.
Here is the main part of the batch file as an example:

========== snipped some code here ==========
                    ; on which computer is it running
                     ; this list can be extended in future if neccessary

           ; you have to edit this datapath and the filepath for the programs
case !version.arch of $
"sparc": begin $
          data_path='/disks/sprite/disk2/hfrey/ago/' &$
         file_path='/disks/sprite/disk1/hfrey/idl/ago/' &$
           dir_sep='/' &$
         dev_name='X' &$
         end &$
"PowerMac": begin $
         data_path='+Hard Disk:applications:IDL:IDL 4.0:ago' &$
         file_path='+Hard Disk:applications:IDL:IDL 4.0:ago' &$
           dir_sep=':' &$
           dev_name='MAC' &$
           end &$
"alpha": begin $
         data_path='[hfr.idl.ago.data' &$
         file_path='[hfr.idl.ago ' &$
         dir_sep='.' &$
         dev_name='X' &$
         end &$
else: begin $
       print,'You have to edit the case statement in ago_config.cmn' &$
       stop &$
       end &$
endcase
================ end of batch ==============================

All my procedures call this batch at the beginning with

@ago_config.cmn

and you might include the platform specific differences in the directory creation
here as well.

Harald
hfrey@ssl.berkeley.edu