Path to library

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

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
andyh1234
Posts: 442
Joined: Mon Aug 13, 2007 4:44 pm
Location: Eccles UK
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: 1005
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 - https://www.screensteps.com

LiveCode Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode
LiveCode Builder Repos - https://github.com/search?q=user%3Atrevordevore+topic:livecode-builder

Post Reply

Return to “Mac OS”