I have a question regarding the proper handling of paths under Catalina, some of which go through the Container, some don't.
More specifically, I get the Pictures folder using this line of code: dir_to_scan = [NSHomeDirectory() stringByAppendingPathComponent: @"Pictures/"] This gives me a path like /Users/zach/Library/Containers/com.apple.ScreenSaver.Engine.legacyScreenSaver/Data/Pictures Then, I start a Spotlight query to collect all images in that folder, like so: query_ = [[NSMetadataQuery alloc] init]; NSPredicate * predicate = [NSPredicate predicateWithFormat: @"(kMDItemContentTypeTree = 'public.image') && (kMDItemFSSize > %u) && (kMDItemPixelHeight > %u) && (kMDItemPixelWidth > %u)", excludekB_ * 1024, excludeSize_, excludeSize_ ]; [query_ setSearchScopes: [NSArray arrayWithObject: dir_to_scan]]; [query_ setPredicate: predicate]; [query_ startQuery]; (Yes, I have a few images in ~/Pictures) Then, I collect them, which also works fine. EXCEPT, apparently, Spotlight gives me paths starting with /Users/zach/Pictures ! (which does make some sense.) Problem is that I can't just do [ array_with_all_images addObject: [path substringFromIndex: ([dir_to_scan length] + 1)] ]; ! I could, of course, handle the case where dir_to_scan = ~/Pictures specially. But I am wondering whether or not I need to adopt a more general approach, i.e., could there be other cases where the dir_to_scan goes through the Container, whereas Spotlight gives me the direct paths? If so, what would be the correct approach? Thanks a lot in advance for all insights. Best regards, 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/archive%40mail-archive.com This email sent to arch...@mail-archive.com