Have you tried -URLByResolvingSymlinksInPath? As far as I’m aware, the Pictures 
entry inside your container is a symlink to the real thing, so assuming you 
have appropriate entitlements, should be possible to resolve it.

Mike.

> On 11 Dec 2022, at 10:56, Gabriel Zachmann via Cocoa-dev 
> <cocoa-dev@lists.apple.com> wrote:
> 
> 
> I have an NSURL * pictures_path;
> 
> By default, this is set to 
> 
>  pictures_path = [ [NSFileManager defaultManager] URLForDirectory: 
> NSPicturesDirectory
>                                             inDomain: NSUserDomainMask
>                                    appropriateForURL: nil create: NO error: 
> &err];
> 
> This works fine.
> 
> Occasionally, I am printing a log message, like so:
> 
>  mesg = [[NSMutableString alloc] initWithString: [mainDirectoryLocation_ 
> pictures_path] ]; 
> 
> and then output that to whatever channel is active (screen or log file).
> 
> Now, in cases where pictures_path is still set to the default, 
> the users sees some thing like:
> 
>  
> /Users/xxxx/Library/Containers/com.apple.ScreenSaver.Engine.legacyScreenSaver/Data/Pictures
> 
> which is confusing to the user (and takes up a lot of space).
> 
> How can I convert this back to the more human-readable /Users/xx/Pictures  or 
> ~/Pictures ?
> 
> I have checked NSURL's doc, but couldn't find a method to convert the path.
> 
> 
> Hints will be appreciated.
> Best, Gabriel.
> 
> _______________________________________________
> 
> 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/mabdullah%40karelia.com
> 
> This email sent to mabdul...@karelia.com

_______________________________________________

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

Reply via email to