On 29.10.2012, at 11:22, Vincent Habchi wrote:

> Since I am here…
> 
> Le 29 oct. 2012 à 10:56, Andreas Grosam <agro...@onlinehome.de> a écrit :
> 
>> With NSFileManager I've created a file in the temporary directory. 
>> Attempting to delete it, fails:
>> 
>>           NSFileManager* fm = [[NSFileManager alloc] init];
>>           NSLog(@"tmp file: %@", [_input1000 path]);
>>           BOOL isDirectory;
>>           if ([fm fileExistsAtPath:[_input1000 path] 
>> isDirectory:&isDirectory] || isDirectory) {
>>               NSError* error;
>>               if ([fm removeItemAtURL:_input1000 error:&error] == NO) {
>>                   NSLog(@"ERROR: tear down testing environment with error: 
>> %@", error);
>>               }
>>           }
>> 
>> Console:
>> 
>> tmp file: 
>> /var/folders/m9/5p__qm3967qchc9_26tl85km0000gn/T/RelaxTest/input1000.txt
>> 
>> ERROR: tear down testing environment with error: Error 
>> Domain=NSCocoaErrorDomain Code=4 "The file “input1000.txt” doesn’t exist." 
>> UserInfo=0x10011e700 
>> {NSURL=/var/folders/m9/5p__qm3967qchc9_26tl85km0000gn/T/RelaxTest/input1000.txt}
> 
> Shouldn’t your URL (the one in the the error message just above) look like 
> ‘file://var/folders…’ rather than a mere ‘/var/folders…’?

Ah!
The URL has been erroneously created as follows:

_input1000 = [NSURL URLWithString:tmpFile];


That should be

_input1000 = [NSURL fileURLWithPath:tmpFile];


Thanks for the hint!  :)

Yet, the createDirectoryAtPath:withIntermediateDirectories:attributes:error: 
issue still exists.


Regards
Andreas
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to