I have a sanboxed mac app with com.apple.security.assets.pictures.read-write entitlement set to YES. Hence, I can access users actual /Users/username/Pictures directory.
I would like to get the path of this directory programmatically, how can I do that?
I currently do the following but it results in the sandbox container Pictures location.
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSPicturesDirectory, NSUserDomainMask, YES);
//this gets the pictures directory in sandbox container not the actual user Pictures directory
NSString *userPicturesPath = [paths objectAtIndex:0];
This folder holds all local information for the app, like your app preferences. If you don't ever give a sandboxed app access to additional files or folders (eg: by choosing extra locations in file handling dialogs), then you can be sure that everything the app stores on your Mac is kept in its sandbox.
It seems to me that the sandbox container Pictures directory is just an symlink to ~/Pictures
. So I believe this is exactly what you want. You can see this by calling stringByResolvingSymlinksInPath
on the userPicturesPath
in your example. You can see that these files are really just symlinks to the corresponding files in your $HOME
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With