OS5: Where to store the ini-file on Mac?
Doug Easterbrook
doug at artsman.com
Sun Dec 4 06:31:03 EST 2011
hi all:
As I read the thread on this, our thoughts have been to store 'ini' things where:
a) people generally expect to find preference files
b) in a visible place
c) that is meaningful to the platform or version of operating system that the user is on
d) is somewhat standard as best as we can find -AND-
e) is sensitive to running on citrix, terminal servers, OSX with remote home directories, etc.
so we came up with using fairly defined operating system locations as follows:
LOCALAPPDATA if you are vista and above
APPTATA if you are XP and lower
HOME is you are unix based operating systems
all of these locations are defined in a standard way using the OS standard locations. This also lets IT folks redirect the location of these standard folders to network drives and still have a good expectation that things work.
its not a lot of code to get the right place (platform dependant) as below. all you need do now is create the file. We used a folder that we can store things in.
and over a number of years of using this, we have discovered that a lot of other apps stick their preference files into these locations.
If isvista()
Calculate iCurrentDirectory as getenv('LOCALAPPDATA')
If isclear(iCurrentDirectory)
Calculate pErrorMessage as "Unable to retrieve 'LOCALAPPDATA' environment variable"
Quit method kFalse
End If
Calculate iTMDBPath as con(iCurrentDirectory,sys(9),'MyPrefsFolder')
Else If I_DOS_MACHINE
Calculate iCurrentDirectory as getenv('APPDATA')
If isclear(iCurrentDirectory)
Calculate pErrorMessage as "Unable to retrieve 'APPDATA' environment variable"
Quit method kFalse
End If
Calculate iTMDBPath as con(iCurrentDirectory,sys(9),'MyPrefsFolder')
Else
; mac & unix use the same mechanism
Calculate iCurrentDirectory as getenv('HOME')
If isclear(iCurrentDirectory)
Calculate pErrorMessage as "Unable to retrieve 'HOME' environment variable"
Quit method kFalse
End If
Calculate iTMDBPath as con(iCurrentDirectory,'/Library/Preferences/MyPrefsFolder') ;; Note: Posix path. will be converted in create directory
End If
Doug Easterbrook
Arts Management Systems Ltd.
mailto:doug at artsman.com
http://www.artsman.com
Phone (403) 536-1205 Fax (403) 536-1210
On Dec 3, 2011, at 10:00 AM, omnisdev-en-request at lists.omnis-dev.com wrote:
> Re: OS5: Where to store the ini-file on Mac?
More information about the omnisdev-en
mailing list