• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Temporary files
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Temporary files


  • Subject: Re: Temporary files
  • From: John Stiles <email@hidden>
  • Date: Tue, 10 Oct 2006 10:58:41 -0700

I believe you could do this with FSFindFolder.

http://developer.apple.com/documentation/Carbon/Reference/ Folder_Manager/Reference/reference.html#//apple_ref/c/func/FSFindFolder

Pass the vRefNum of the volume of pathA and a folder type of kChewableItemsFolderType. (To get a vRefNum from a path, call FSPathMakeRef and then use FSGetCatalogInfo.)
Be prepared for this to fail on some volumes, though. For example, on a network volume, you won't have a chewable folder. And I believe on some volumes you may find that you don't have write permission to chewable.



On Oct 10, 2006, at 8:49 AM, Martin Hairer wrote:

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:
40blizzard.com


This email sent to email@hidden

_______________________________________________ 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
  • Follow-Ups:
    • Re: Temporary files
      • From: Martin Hairer <email@hidden>
References: 
 >Temporary files (From: Martin Hairer <email@hidden>)

  • Prev by Date: Re: Temporary files
  • Next by Date: Re: Temporary files
  • Previous by thread: Re: Temporary files
  • Next by thread: Re: Temporary files
  • Index(es):
    • Date
    • Thread