- Why are you using FSSpec instead of FSRef? FSSpec is going away and
it can't handle modern Unicode Filenames without resorting to strange
hacks.
- FSpRename expects a name not a path as the second argument. And
also even if it would accept a path it would have to be HFS path not
a POSIX path.
- FSpRename expects a pascal string as the second parameter, not a C
string.
Use FSRenameUnicode() instead.
//path2fss makes an FSSpec from a path with or without
a filename
int path2fss(FSSpec *fss, char *path)
{
char buf[256];
char *p = &buf[1];
strcpy(p, path); //convert to Str255
buf[0] = strlen(p);
return(FSMakeFSSpec(0, 0, (unsigned char *)buf,
fss)); //== noErr
}
If you'd use FSRef then you could use the FSPathMakeRef() built-in
function to create the FSRef from the path.
Depending on how you actually get the path to the file in the first
place you could do this:
UInt8 x[] = "/Users/justin/Movies/e1.mov"; // Just for illustration.
FSRef ref;
OSStatus err = FSPathMakeRef(x,&ref,NULL);
if (noErr == err)
{
// Just for illustration. Use a better method to get the new name
in real code:
UniChar newName[] = {0x0065, 0x0031, 0x002e, 0x006d, 0x006f,
0x0076, 0x0078};
HTH
Mike
--
Mike Fischer Softwareentwicklung, EDV-Beratung
Schulung, Vertrieb
Web: <http://homepage.mac.com/mike_fischer/index.html>
Note: I read this list in digest mode!
Send me a private copy for faster responses.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden