Page 1 of 1

Path to library

Posted: Wed Oct 03, 2007 7:57 pm
by andyh1234
Is there a specialfolderpath available for the 'Library' folder on a mac?

I can find the preferences one using the following, but obviously Id prefer my database to be stored in the library and not the preferences!

put specialfolderpath("preferences") & "/myApp/myDB.db" into dbPath

Posted: Thu Oct 04, 2007 2:47 pm
by trevordevore
I don't know of a code that points directly to the Library but "asup" will point to the Application support folder in the root library "/Library/Application Support". I imagine you would want to store your data in this sub folder in any case so maybe that will work for you.

To get the users app support folder (/Users/USERNAME/Library/Application Support) you can do the following:

Code: Select all

put the defaultfolder into theDefaultFolder
set the defaultfolder to "~"
put the defaultfolder & specialfolderpath("asup") into thePath
set the defaultfolder to theDefaultFolder
Rev will convert "~" to the users home folder for you and then you can just append the value of specialfolderpath("asup"). This technique is more reliable than using the $HOME environmental variable which is not always set.