Re: Determining install directory [message #43925] |
Tue, 03 May 2005 15:16 |
I M Chapman
Messages: 2 Registered: May 2005
|
Junior Member |
|
|
Exactly what I was looking for. Thank you sir.
-Ian
David Fanning wrote:
> I M Chapman writes:
>
>> I am writing an application for the IDL Virtual Machine. Some of
the
>> inputs to the application will come from variables that I will
store on
>> the users' hard drives.
>>
>> Now, assuming that I allow a user to install the app wherever they
want
>> on their system, is there any way to detect where the data
directory
>> is? I assume that it will involve some sort of findfile command,
but I
>> can't seem to work it out.
>
> I presume the "data" directory is related to the "install"
> directory in some way, perhaps a sub-directory of it. If so,
> then ProgramRootDir on my web page is useful. It can tell you
> the directory where the current program is running (or, with
> the optional ONEUP keyword, the one above the one where the
> source code is running.
>
> I write my applications so they can be installed in any user
> directory. When they install they set up, for example, a "source"
> sub-directory and a "data" sub-directory. To locate a file in
> the data directory, say the file logo.jpg, I would do something
> like this in any one of the source files:
>
> logoFile = Filepath(Root_Dir=ProgramRootDir(/Oneup), $
> Subdir=['data'], 'logo.jpg')
>
> Or, because usually the project builds the save file I want to
> run on the VM in the "install" directory, I might do this:
>
> logoFile = Filepath(Root_Dir=ProgramRootDir(Oneup=LMGR(/VM) NE 1),
$
> Subdir=['data'], 'logo.jpg')
>
> You can find the ProgramRootDir program here:
>
> http://www.dfanning.com/programs/programrootdir.pro
>
>
>> Also, can the VM distinguish between a windows system and a Unix
>> system? This will be important so that I can adjust the file calls
to
>> reflect the different file systems.
>
> Whoops! I hope you are already specifying filenames in a machine-
> independent way. That's what FILEPATH is used for. :-)
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
Re: Determining install directory [message #43926 is a reply to message #43925] |
Tue, 03 May 2005 15:06  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
I M Chapman writes:
> I am writing an application for the IDL Virtual Machine. Some of the
> inputs to the application will come from variables that I will store on
> the users' hard drives.
>
> Now, assuming that I allow a user to install the app wherever they want
> on their system, is there any way to detect where the data directory
> is? I assume that it will involve some sort of findfile command, but I
> can't seem to work it out.
I presume the "data" directory is related to the "install"
directory in some way, perhaps a sub-directory of it. If so,
then ProgramRootDir on my web page is useful. It can tell you
the directory where the current program is running (or, with
the optional ONEUP keyword, the one above the one where the
source code is running.
I write my applications so they can be installed in any user
directory. When they install they set up, for example, a "source"
sub-directory and a "data" sub-directory. To locate a file in
the data directory, say the file logo.jpg, I would do something
like this in any one of the source files:
logoFile = Filepath(Root_Dir=ProgramRootDir(/Oneup), $
Subdir=['data'], 'logo.jpg')
Or, because usually the project builds the save file I want to
run on the VM in the "install" directory, I might do this:
logoFile = Filepath(Root_Dir=ProgramRootDir(Oneup=LMGR(/VM) NE 1), $
Subdir=['data'], 'logo.jpg')
You can find the ProgramRootDir program here:
http://www.dfanning.com/programs/programrootdir.pro
> Also, can the VM distinguish between a windows system and a Unix
> system? This will be important so that I can adjust the file calls to
> reflect the different file systems.
Whoops! I hope you are already specifying filenames in a machine-
independent way. That's what FILEPATH is used for. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
Re: Determining install directory [message #43928 is a reply to message #43926] |
Tue, 03 May 2005 14:17  |
Michael Wallace
Messages: 409 Registered: December 2003
|
Senior Member |
|
|
> Also, can the VM distinguish between a windows system and a Unix
> system? This will be important so that I can adjust the file calls to
> reflect the different file systems.
System information is stored in the !VERSION system variable. The
following command should be quite illuminating.
help, !version, /STRUCTURE
-Mike
|
|
|