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/
|
|
|