Skip navigation.
 
mlMissing created files
FROM : Michael Becker
DATE : Fri Nov 05 16:15:30 2004

Hi!

Very weird problem: I am trying to save an image as JPG to disk. Even
though Cocoa tells me everything is fine, there is no file! Here is my
code:

NSLog(@"Creating file at %@", path);
NSData *imageData = [imageRep representationUsingType:NSJPEGFileType
properties:propDict];    
BOOL successful = [[ NSFileManager defaultManager]
createFileAtPath:path contents:imageData attributes:nil];
if (successful) NSLog(@"Successful");

All the objects are valid (there are no nil's etc.), I checked that.
The runtime output is:

2004-11-05 16:08:56.925 PhotoClient3[645] Creating file at
/Users/michael/.photoservice/0.jpg
2004-11-05 16:08:57.515 PhotoClient3[645] Successful

And here is the output of the Terminal:

of081:~/.photoservice michael$ ls -la
total 0
drwxr-xr-x  2 michael  michael    68  5 Nov 16:13 .
drwxr-xr-x  30 michael  michael  1020  5 Nov 16:12 ..
of081:~/.photoservice michael$

What is happening here? Before trying to create the file, I tried
NSData's writeToFile:atomically: which did not work either. However, if
a file at the given path already EXISTS, there seems to be no problem
at all.
What am I missing here?

Regards,
Michael

Related mailsAuthorDate
mlMissing created files Michael Becker Nov 5, 16:15
ml[SOLVED] Re: Missing created files Michael Becker Nov 5, 16:23