Temporary files
Temporary files
- Subject: Temporary files
- From: Martin Hairer <email@hidden>
- Date: Tue, 10 Oct 2006 16:49:03 +0100
Hello, I was just wondering whether there is a simple Cocoa-ish way of
performing the following: given a path (say pathA) to a file
(existing or not),
I would like to get a path (say pathB) with the following properties:
1. pathB should not point to an existing file.
2. pathB should point into a temporary / crushable files folder.
3. (Most important) if a file is written to pathB, it should be
possible to move
it to pathA without involving a file copying operation.
There are two approaches that come to mind:
1. Take pathB to point into the same directory as pathA. This doesn't
conform to
point 2 and so there could be files left littering the disk if the
application happens
to crash before it got the chance to delete the file at pathB.
2. Check on which volume pathA is located and use the Folders API to
locate
the temporary files folder on that volume. This should solve the
problem, but
somehow doesn't sound like a very clean way of doing it. Also,
will this behave
as expected (i.e. conform to point 3 above) if pathA is on a
networked volume
or inside a directory structure that was mounted "by hand" in a
non-standard
location?
Cocoa does something like this when saving a file (i.e. it really
saves it to pathB
and then deletes the file at pathA and swaps the two files) so my
question is probably
whether there's a supported way to tap into this functionality
without having to
reimplement it. Regards,
Martin
HairerSoft
http://www.hairersoft.com/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden