Re: Best practice for creating a temporary file

2014-09-02 Thread Jens Alfke
> On Sep 2, 2014, at 4:18 PM, Quincey Morris > wrote: > > Then is there any downside to letting it appear beside the final location? It's not the location that bugs me, so much as that it never gets cleaned up. So the parent directory starts accumulating more and more of these empty "(Docum

Re: Best practice for creating a temporary file

2014-09-02 Thread Kyle Sluder
On Tue, Sep 2, 2014, at 06:10 PM, Jens Alfke wrote: > > > On Sep 2, 2014, at 4:05 PM, Quincey Morris > > wrote: > > > > I get a URL to a new folder in the private (secure) temporary directory, > > and *not* in the parent of ‘importURL’. I don’t know why you’re seeing > > something different.

Re: Best practice for creating a temporary file

2014-09-02 Thread Quincey Morris
On Sep 2, 2014, at 16:10 , Jens Alfke wrote: > This is on iOS. Then is there any downside to letting it appear beside the final location? Where does an app like Pages create its autosaves? (AFAIK, autosave uses this same API for its temp folder.) IIRC, in iOS the recommendation is to put docu

Re: Best practice for creating a temporary file

2014-09-02 Thread Jens Alfke
> On Sep 2, 2014, at 4:05 PM, Quincey Morris > wrote: > > I get a URL to a new folder in the private (secure) temporary directory, and > *not* in the parent of ‘importURL’. I don’t know why you’re seeing something > different. This is on iOS. (On Mac OS I do see the file appear in the tempor

Re: Best practice for creating a temporary file

2014-09-02 Thread Quincey Morris
On Sep 2, 2014, at 09:47 , Jens Alfke wrote: > So far I've been using NSItemReplacementDirectory, but this has a couple of > problems: > (1) It creates a new visible directory right next to the permanent location, > called "(A Document being saved by $APP") where $APP is the app name. FWIW, th

Re: Best practice for creating a temporary file

2014-09-02 Thread Scott Ribe
Maybe you could: - write the temp path into a file in Application Support or someplace where you can read it at launch - make a temp invisible file at that temp path in the actual destination folder - rename the temp invisible file and make it visible - clear the temp path where you'd written it

Re: Best practice for creating a temporary file

2014-09-02 Thread Jens Alfke
> On Sep 2, 2014, at 10:45 AM, Kyle Sluder wrote: > > .TemporaryItems doesn't get cleaned up automatically AFAIK, so I don't > think you'll gain anything by trying to use it. On my system right now there's nothing in it older than 2 days or so, so I suspect it does get cleaned up (at least on

Re: Best practice for creating a temporary file

2014-09-02 Thread excelpbhardwaj...@gmail.com
: "Cocoa-dev@lists.apple.com dev" Date: Tuesday, September 2, 2014 9:47:37 AM GMT-0700 Subject: Best practice for creating a temporary file I'm downloading data that will eventually be saved as a file in a specific directory. During the download I write the data to a temporary file s

Re: Best practice for creating a temporary file

2014-09-02 Thread Kyle Sluder
On Tue, Sep 2, 2014, at 11:47 AM, Jens Alfke wrote: > > It looks as though there _is_ a per-volume temporary-items directory, > because on my non-boot partition I see a top-level invisible directory > called ".TemporaryItems" with a subfolder for each user-ID. But how do I > find it programmatical

Best practice for creating a temporary file

2014-09-02 Thread Jens Alfke
I'm downloading data that will eventually be saved as a file in a specific directory. During the download I write the data to a temporary file since it can be arbitrarily large; then on completion I move the temporary file to its final location. So I need to locate a temporary-files directory th