Re: Strange NSFileManager file replacement issue

2011-08-19 Thread Ken Thomases
On Aug 19, 2011, at 12:43 AM, Ken Thomases wrote: On Aug 19, 2011, at 12:38 AM, Ken Thomases wrote: Although it is easy to interpret a temporary directory as provided by the OS being compatible with NSTemporaryDirectory(), I suspect it really means a directory returned by

Re: Strange NSFileManager file replacement issue

2011-08-19 Thread Sixten Otto
On Thu, Aug 18, 2011 at 10:14 PM, Quincey Morris quinceymor...@rivergatesoftware.com wrote: a. What version of iOS did this fail on? The 4.3 simulator (running on Snow Leopard, Xcode 4.0.2). b. Can you assert that the receiver of the 'replaceā€¦' method is not nil? (If it was nil, the

Re: Strange NSFileManager file replacement issue

2011-08-19 Thread Sixten Otto
On Thu, Aug 18, 2011 at 10:38 PM, Ken Thomases k...@codeweavers.com wrote: My thinking is that -replaceItemAtURL:... is a wrapper around exchangedata() or FSExchangeObjects(). Those functions, and the general operation that they perform, require that the files to be exchanged be on the same

Re: Strange NSFileManager file replacement issue

2011-08-19 Thread Sixten Otto
On Thu, Aug 18, 2011 at 10:14 PM, Quincey Morris quinceymor...@rivergatesoftware.com wrote: c. Can you show us the actual line of code that does the replacement? Here's the original code (plus the addition of an assert on the file manager). The property self.filePath has the path to the current

Re: Strange NSFileManager file replacement issue

2011-08-19 Thread Steve Christensen
On Aug 19, 2011, at 7:17 AM, Sixten Otto wrote: On Thu, Aug 18, 2011 at 10:38 PM, Ken Thomases k...@codeweavers.com wrote: Those functions, and the general operation that they perform, require that the files to be exchanged be on the same file system. If true, that certainly makes that

Re: Strange NSFileManager file replacement issue

2011-08-19 Thread Sixten Otto
On Fri, Aug 19, 2011 at 1:14 PM, Steve Christensen puns...@mac.com wrote: Is there any reason why you can't put the downloaded file in your app's private cache directory (.../appdir/Library/Caches), i.e., what gets returned by NSSearchPathForDirectoriesInDomains(NSCachesDirectory,

Re: Strange NSFileManager file replacement issue

2011-08-19 Thread Ken Thomases
On Aug 19, 2011, at 10:29 AM, Sixten Otto wrote: This morning, I replaced the code between the *** 1 and *** 2 with the following, which still failed in exactly the same way. It does get create a replacement directory and return it, my temp file moves into that directory without issue, but

Strange NSFileManager file replacement issue

2011-08-18 Thread Sixten Otto
I have an iOS app where I'm storing files in the app's Documents directory, and occasionally downloading new versions from the server to replace them. The actual code is split across a number of files and classes, but the end of the process goes like this: - The download of the new data to a

Re: Strange NSFileManager file replacement issue

2011-08-18 Thread Quincey Morris
On Aug 18, 2011, at 21:24 , Sixten Otto wrote: That method returns NO for failure, so I check the error... but it's nil. There's nothing there to tell me what the heck is failing. (In fact, when I wasn't initializing my error pointer to nil, it was left as a garbage pointer, and crashed my

Re: Strange NSFileManager file replacement issue

2011-08-18 Thread Ken Thomases
On Aug 18, 2011, at 11:24 PM, Sixten Otto wrote: - The download of the new data to a temporary file in NSTemporaryDirectory() finishes successfully. - I calculate the path I want to copy it to. - I see that there's already a previous version of the file at that path. - I try to use

Re: Strange NSFileManager file replacement issue

2011-08-18 Thread Ken Thomases
On Aug 19, 2011, at 12:38 AM, Ken Thomases wrote: Although it is easy to interpret a temporary directory as provided by the OS being compatible with NSTemporaryDirectory(), I suspect it really means a directory returned by -URLForDirectory:inDomain:appropriateForURL:create:error: with