Re: help with FSPathMakeRef
Re: help with FSPathMakeRef
- Subject: Re: help with FSPathMakeRef
- From: Aki Inoue <email@hidden>
- Date: Thu, 21 Jun 2001 16:25:03 -0700
Unfortunately, you have to create a temporary file using
FSCreateFileUnicode.
This is a modified version that uses the function.
NSSavePanel *sp;
FSSpec fileSpec;
FSRef ref;
int spResult;
OSStatus status;
sp = [NSSavePanel savePanel];
[sp setRequiredFileType:@"mov"];
spResult = [sp runModalForDirectory:NSHomeDirectory() file:@""];
if (spResult == NSOKButton) {
NSString *pathname = [sp filename];
NSString *directory = [pathname
stringByDeletingLastPathComponent];
NSString *filename = [pathname lastPathComponent];
short refNum;
Movie movie = NULL;
UniChar characters[255];
// I need to make some QT api calls that require an FSSpec so I
// attempt to convert the path to an FSSpec...
status = FSPathMakeRef([directory fileSystemRepresentation], &ref,
NULL);
[filename getCharacters:characters];
status = FSCreateFileUnicode(&ref, [filename length],
characters, kFSCatInfoNone, NULL, NULL, &fileSpec);
EnterMovies();
status = CreateMovieFile(&fileSpec, FOUR_CHAR_CODE('TVOD'),
smCurrentScript,
createMovieFileDeleteCurFile|createMovieFileDontCreateResFile, &refNum,
&movie);
DisposeMovie(movie);
CloseMovieFile(refNum);
DeleteMovieFile(&fileSpec);
ExitMovies();
}
Note you have to specify createMovieFileDeleteCurFile for
CreateMovieFile.
Aki
On 2001.06.21, at 14:37, Gonzalo Castro wrote:
I'm trying to convert a pathname to an FSSpec so I can later call
the QT api CreateMovieFile which requires an FSSpec.
I'm using the NSSting to FSSpec conversion code from this list's
archives. However, the file in question doesn't exist yet and so I
get -43 error code returned from FSPathMakeRef _and_ it doesn't
give back anything in 'ref'. When I create the file before running
this code FSPathMakeRef returns noErr with (I think) a valid ref,
and the next call (FSGetCatalogInfo) returns noErr with a valid FSSpec.
What am I doing wrong? How can I get an FSSpec of a file-to-be?
Thanks for any help.
NSSavePanel *sp;
FSSpec fileSpec;
FSRef ref;
int spResult;
OSStatus status;
sp = [NSSavePanel savePanel];
[sp setRequiredFileType:@"mov"];
spResult = [sp runModalForDirectory:NSHomeDirectory() file:""];
if (spResult == NSOKButton)
{
// I need to make some QT api calls that require an FSSpec so I
// attempt to convert the path to an FSSpec...
status = FSPathMakeRef[[sp filename] fileSystemRepresentation],
&ref, NULL);
status = FSGetCatalogInfo(&ref, kFSCatInfoNone, NULL, NULL,
&fileSpec, NULL);
}
_______________________________________________
cocoa-dev mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/cocoa-dev