Le 12 août 09 à 16:10, Jerry Krinock a écrit :

Because my application deals with a small number of documents -- most users will have only one, and because these documents have "agents" associated with them and are often not edited, I want my app to warn the user immediately upon opening a document that is in the Trash, instead of the default Cocoa behavior which is to open it and complain later only if the user attempts to save changes.

Unfortunately, the correct way to determine if a file is in a special directory, using Folder Manager function FSDetermineIfRefIsEnclosedByFolder(), does not seem able to determine whether or not a path that I get from the url passed to - [NSDocument readFromURL:ofType:error:] is temporary. The first problem is that Cocoa apparently copies the file to a temporary directory, something like
    /private/var/folders/PR/PRtZlutkFa82jPnfdYcUUk+++TI/-Tmp-/
before opening it, so this path is indeed "not in the trash".

OK, so then I try FSDetermineIfRefIsEnclosedByFolder() again, and again, passing kTemporaryFolderType, kChewableItemsFolderType, kTemporaryItemsInCacheDataFolderType, and kWhereToEmptyTrashFolderType in succession. But it in each case, it returns 'false' -- meaning that the file is not in the specified special directory.

What did you used as domainOrVRefNum ?

You can use FSFindFolder() to determine exactly what each of the values means.


_______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to