A tip for anyone converting a CodeWarrior Mach-O plugin to XCode... REALpathFromFolderItem returns a path that works with CodeWarrior's fopen, but not XCode's. The path is an old-style Mac path (: separated), not a UNIX path that fopen expects. Am I missing an easier way of opening a file than I use below? Is there something here that should be feature requested? I get the string path, make a new string prepended by "/Volumes/", append the path, and convert ':'s to '/'s.

-Brad
--
Brad Hutchings
e-mail: [EMAIL PROTECTED]




REALfolderItem fi; // a parameter

REALstring path = REALpathFromFolderItem(fi);
if (path != NULL)
{
        const char* path_string = REALCString(path);
        if (path_string != NULL)
        {
                char* unix_path_string = malloc(strlen(path_string) + 100);
                if (unix_path_string != NULL)
                {
                        strcpy(unix_path_string, "/Volumes/");
                        strcat(unix_path_string, path_string);
                        
                        for (char* x = unix_path_string; *x != 0; x++)
                        {
                                if (*x == ':')  *x = '/';
                        }
                
                        file_ref = fopen(unix_path_string, "rb");
                        
                        free(unix_path_string);
                }
        }
}



_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to