Determine if a file is inside any macOS Trash folder
问题 There's a similar question for iOS, but I found that the proprosed solutions do not work on macOS in all cases. On a Mac, there are many possible Trash folders: /.Trashes ~/.Trash ~/Library/Mobile Documents/com~apple~CloudDocs/.Trash – this one is from iCloud /Users/xxx/.Trash – any other user's trash /Volumes/xxx/.Trashes This code should work but doesn't for the case of the iCloud trash: NSURL *theURL = ...; NSURLRelationship relationship = NSURLRelationshipOther; NSError *error = nil;