specialFolderPath - Where to store Preferences Crossplattform

Klaus Major klaus at major-k.de
Tue Dec 2 12:50:03 EST 2003

Hi Malte and all,

> Hi list,
> I hope the Win/*nix users can help me...
> I know this has been covered somewhere deep down in the archives, but I
> cannot find it with both google and alexs search engine.
> Has anyone written a handler to store preferences cross plattform?
> I need a reliable path to a folder where I can write preferences to 
> cross
> plattform. On the mac specialFolderPath ("preferences") works fine for 
> both,
> 9 and flavours of X. But  what is the pendant on Win/*nix?

Here is a little function i wrote to get the correct, read write 
permissioned" folder...

function safe_place_to_store_my_bloody_prefs
   switch the platform
   case "MacOS"
     put specialfolderpath("preferences") into spfp
   case "Win32"
     if word 1 of the systemversion = "NT" then
       put specialFolderPath(35) into spfp
       put specialfolderpath("system") into spfp
     end if
     put $HOME into spfp
   end switch
   return spfp & "/"
end safe_place_to_store_my_bloody_prefs

On a mac it returns:
OS > 10 -> System/Preferences/
OS X -> Your homefolder/Library/Preferences

On Win:
95, 98 & ME -> the black hole a.k.a the bermuda triangle ;-) -> 
NT, 2000 & XP -> C:/Documents and Settings/All Users/Application Data/

(Not always "C:" of course, but you get the picture... ;-)

On Unix/Linux:
the homefolder of the currentuser

Since i have little knowledge of *NIX there might be better places
to store the prefs, but i don't know them ;-)

At least the current user CAN write to his homefolder...

> Thanks a lot,

Hope that helps...

> Malte


Klaus Major
klaus at major-k.de

More information about the Use-livecode mailing list