-stringByAbbreviatingWithTildeInPath First page in google results
> On Dec 11, 2022, at 15:06, 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/admin.szatmari.net%40gmail.com > > This email sent to admin.szatmari....@gmail.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