Re: Files can't be saved to the relative paths?
Re: Files can't be saved to the relative paths?
- Subject: Re: Files can't be saved to the relative paths?
- From: Andrew Merenbach <email@hidden>
- Date: Sat, 18 Aug 2007 20:04:31 -0700
Hi, Steve,
You'll want the method -[NSString stringByExpandingTildeInPath:].
Use a tilde, in this case, rather than $HOME.
Cheers,
Andrew
On Aug 19, 2007, at 3:51 AM, Steve wrote:
Hi Everyone.
What I want to do is capture some pictures of the movie, then save
them to the current desktop. Then I use the code following:
NSImage * currentFrameImage = [movie currentFrameImage];
// get current frame presented by NSImage
NSData * tiffData = [currentFrameImage TIFFRepresentation];
//get the tiff Data from the NSImage
NSCalendarDate * newCalendarDate = [NSCalendarDate calendarDate];
[newCalendarDate setCalendarFormat:@"%Y%m%d%H%M%S"];
NSString * fileName = [NSString stringWithFormat:@"%@-%@.tiff",
[[globalPath lastPathComponent] stringByDeletingPathExtension],
[newCalendarDate description]];
//NSLog(fileName);
//The following path is the issue.
NSString * folderPath = @"/";
//
NSString * resultString = [folderPath
stringByAppendingPathComponent:fileName];
NSLog(resultString);
if ([tiffData writeToFile:resultString atomically:YES] ) {
printf("Image Saved\n");
}
I used the folderPath variable to present the path. However , if I
wrote
code like these: folderPath = @"$HOME/Desktop", the tiffDate
writeToFile function never works. I don't know why, perhaps you
have to write to absolute path?
Thank you for any reply.
Cheers.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden