On Jan 8, 2020, at 15:29:47, Gabriel Zachmann via Cocoa-dev <cocoa-dev@lists.apple.com> wrote: > > 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 ?
That's how sandboxing works. My image-based screensaver works the same way, although the folders need to be chosen by the user, which ensures it has access to the files within, and I store security-scoped bookmark data for each url they choose. A sandboxed app can only access files through its container folder (~/Library/Containers/com.whatever.app/blah blah). And for 10.15 at least, that's the screensaver engine that runs your screensaver. It makes one think that Apple might be developing a framework for newer (non-legacy) screensavers in the future. > Also, I am trying to read some data from a file in Application Support. > <snip> > 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? Again, that's fine. That's the actual path that sandboxing will use. But if Apple does away with the legacy screensaver in the future, who knows if they'll automatically transfer files stored by 3rd party screensavers, or if they'll just start fresh. -- Steve Mills Drummer, Mac geek _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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 arch...@mail-archive.com