I have two questions regarding sandboxing.

1.

In my screensaver, I try to search the Pictures directory in the user's home.
It is OK - for now - if my app cannot access any .photoslibrary, but I'd like 
to pick up
any other images in ~/Pictures.

I get the path using this line of code:
   [NSHomeDirectory() stringByAppendingPathComponent: @"Pictures/"]

However, when I print the actual path to the system log, it says it is 
accessing this path:
   
/Users/me/Library/Containers/com.apple.ScreenSaver.Engine.legacyScreenSaver/Data/Pictures

Is this directory somehow linked to ~/Pictures ?
Or how can I access the true ~/Pictures directory ?

(Under Mojave, my screensaver can access ~/Pictures just fine - except for any 
.photoslibrary, which is OK, sort of, for the moment.)



2.

Also, I am trying to read some data from a file in Application Support.
So far, I do that like this:


NSFileManager *fmanager_ = [NSFileManager defaultManager];
NSArray * appSupportDir = [fmanager_ URLsForDirectory: 
NSApplicationSupportDirectory
                                                inDomains: NSUserDomainMask ];

NSURL * url = [ [appSupportDir objectAtIndex: 0] URLByAppendingPathComponent: 
@"ArtSaver" ];
NSString * folder = [url path];
NSError * theError = nil;
[fmanager_ createDirectoryAtPath: folder withIntermediateDirectories: YES
                                 attributes: nil error: &theError];
NSURL * url = [ [appSupportDir objectAtIndex: 0] URLByAppendingPathComponent: 
@"ArtSaver" ];
NSString * folder = [url path];
NSError * theError = nil;
fmanager_ createDirectoryAtPath: folder withIntermediateDirectories: YES
                                 attributes: nil error: &theError];
path = [folder stringByAppendingPathComponent: [NSString stringWithFormat: 
@"LastRunInfo.%@.plist", displayname] ];
lastRunInfoPath_ = [NSURL fileURLWithPath: path isDirectory: NO];


When I print lastRunInfoPath_ , I get
lastRunInfoPath = 
file:///Users/me/Library/Containers/com.apple.ScreenSaver.Engine.legacyScreenSaver/Data/Library/Application%20Support/ArtSaver/LastRunInfo.plist

Can I continue with this just as before under Mojave?
Will info stored in such a plist be persistent?



Best regards, Gabriel


_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to