开发者

How to get NSString (Unix style path) from FSSpec

How to get NSSt开发者_开发百科ring (Unix style path) from FSSpec

Regards, Dhana.


  1. Create an FSRef for the FSSpec.
  2. Create a CFURL for the FSRef.
  3. Copy or get an NSString of the URL's file-system path, using either the CFURLCopyFileSystemPath function or the -[NSURL path] method.

Don't forget to release the CFURL, since you Created it. The same goes for the path, if you Copied it.


I think below code will work fine..

If wrong please modify..

char * UnixPathFromFSSpec(FSSpec *sfile)
{
    char unixPath[2048];
    unixPath[0] = '\0';
    FSRef ref;

    if(FSpMakeFSRef(sfile, &ref) == noErr )
    {
        FSRefMakePath(&ref, unixPath, sizeof(unixPath));
    }

    return unixPath;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜