On May 14, 2011, at 12:46 AM, Rick Mann wrote:
> 10.6.7. I'm using
>
> -[URLForDirectory:inDomain:appropriateForURL:create:error:]
>
> (with create: true) to get a NSItemReplacementDirectory for safe-saving of a
> file. I create a temporary file in that directory for writing, then replace.
>
> The directory that gets created looks like (for my app "Foo"):
>
> /private/var/folders/0O/0O9Zc+ZKFCy+BtbYF754gk+++TI/-Tmp-/
> /TemporaryItems/(A Document Being Saved By Foo 4)/
>
> Each time I call -URLForDirectory:…, my app, it's a new directory ("…Foo 5",
> "…Foo 6", etc.). In the TemporaryItems directory I see Numbers created one
> named "TEMP_com.apple.iWork.Numbers_33370_326976525_1".
>
> How does Numbers control the name of the directory it creates?
>
> Is there any way to keep Cocoa from making a new directory every time?
Numbers may be using the older technique for obtaining the temporary items
directory location: FSFindFolder() with kTemporaryFolderType. That gives a
path to the TemporaryItems directory, not a thing within it. From there,
Numbers can append whatever other path component(s) it likes.
So, this raises the question: why do you care? The whole point of using these
APIs is that the particular path returned is of no consequence, so long as it
supports the proper semantics (things will be cleaned up if necessary and you
can do a proper atomic replacement operation because it's on the same file
system).
Regards,
Ken
_______________________________________________
Cocoa-dev mailing list ([email protected])
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 [email protected]