Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Writing to "~/Library/Application Support" folder in Mac OS X 10.7

Tags:

cocoa

I can use NSFileManager to create a XYZ folder in "/Library/Application Support" in Mac OS X 10.5 and 10.6. However, in 10.7, it says "You don't have permission to save XYZ in the folder 'Application Support'".

Does anyone know what I can do (e.g. which API to call) to get that permission to create the folder? Thanks.

like image 513
glendon Avatar asked Dec 05 '22 20:12

glendon


1 Answers

Are you using sandboxing? If so, you’re writing to the wrong place. In either case, you should be using NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES) to find the right path rather than hard-coding it.

like image 170
Jens Ayton Avatar answered May 27 '23 21:05

Jens Ayton