Re: FSSpec for saving a movie with FlattenMovieData() from an NSString*?
Re: FSSpec for saving a movie with FlattenMovieData() from an NSString*?
- Subject: Re: FSSpec for saving a movie with FlattenMovieData() from an NSString*?
- From: "Timothy J. Wood" <email@hidden>
- Date: Sun, 21 Apr 2002 23:08:57 -0700
On Sunday, April 21, 2002, at 10:22 PM, Michael B. Johnson wrote:
[...[
I can't figure out how to go from @"/tmp/foo.mov" to an FSSpec that it
likes.
[...]
NSURL *fileUrl = [NSURL fileURLWithPath:fileName];
FSSpec fileFSSpec;
FSRef fileFSRef;
// get an FSRef for our file
Boolean gotFSRef = CFURLGetFSRef((CFURLRef)fileUrl,
&fileFSRef);
// get an FSSpec for the same file
status = FSGetCatalogInfo(&fileFSRef, kFSCatInfoNone, NULL,
NULL, &fileFSSpec, NULL);
This looks right to me. We have some working code in
OmniFoundation/OFCodeFragment (and similar code a couple other places in
our frameworks) that does:
CFURLRef url;
FSRef fsRef;
FSSpec fsSpec;
OSErr err;
Boolean success;
path = [aPath copy];
url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault,
(CFStringRef)path, kCFURLPOSIXPathStyle, false);
success = CFURLGetFSRef(url, &fsRef);
CFRelease(url);
if (!success) {
...
}
err = FSGetCatalogInfo(&fsRef, kFSCatInfoNone, NULL, NULL, &fsSpec,
NULL);
if (err != noErr) {
...
}
... and then proceeds to use the fsSpec to open a code fragment.
So, maybe the problem is some subtle difference between +[NSURL
fileURLWithPath:] and CFURLCreateWithFileSystemPath() or perhaps you are
getting a valid FSSpec and something is going wrong after that point.
-tim
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.