Path to library

Deploying to Mac OS? Ask Mac OS specific questions here.

Moderators: heatherlaine, Klaus, FourthWorld, robinmiller, kevinmiller

Post Reply
andyh1234
Posts: 376
Joined: Mon Aug 13, 2007 4:44 pm
Location: Sale UK / FL USA
Contact:

Path to library

Post by andyh1234 » Wed Oct 03, 2007 7:57 pm

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

trevordevore
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 882
Joined: Sat Apr 08, 2006 3:06 pm
Location: Overland Park, Kansas
Contact:

Post by trevordevore » Thu Oct 04, 2007 2:47 pm

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.
Trevor DeVore
ScreenSteps - http://www.screensteps.com

Levure Application Framework: https://github.com/trevordevore/levure
LiveCode Resources for Developers: http://livecode.bluemangolearning.com

Post Reply

Return to “Mac OS”