CVS: winex/files drive.c,1.43,1.44

[email protected]
Newsgroups gmane.comp.emulators.winex.cvs
Message-ID <[email protected]>
Subject: winex/files drive.c,1.43,1.44Update of /var/lib/cvsd/cvsroot/winex/files
In directory agravaine:/tmp/cvs-serv12851/files

Modified Files:
	drive.c 
Log Message:

- support @USERPREFS@ in a drive path
- on MacOS X, map "My Documents" to P:\ (if it exists) instead of C:\


Index: drive.c
===================================================================
RCS file: /var/lib/cvsd/cvsroot/winex/files/drive.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- drive.c	28 Mar 2007 18:39:15 -0000	1.43
+++ drive.c	30 Mar 2007 20:05:47 -0000	1.44
@@ -583,6 +583,35 @@
                        return_value = 1;
                }
        }
+       else if (strstr (path, "@USERPREFS@"))
+       {
+          char *pNewPath;
+          char *pEnvPtr;
+          const char *pRestOfPath;
+
+          /* On the Apple, this contains the path to the user's individual
+             Cider game directory:
+             /Users/foo/Library/Preferences/Cider <game> Preferences/ */
+          pEnvPtr = getenv ("WINEPREFIX");
+          if (!pEnvPtr)
+             return 0;
+
+          pNewPath = HeapAlloc (GetProcessHeap (), 0,
+                                sizeof (char *) * path_size);
+          if (!pNewPath)
+             return 0;
+
+          pRestOfPath = strrchr (path, '@') + 1;
+
+          snprintf (pNewPath, path_size, "%s%s", pEnvPtr,
+                    pRestOfPath);
+
+          strncpy (path, pNewPath, path_size);
+          path[path_size - 1] = '\0';
+          HeapFree (GetProcessHeap (), 0, pNewPath);
+
+          return_value = 1;
+       }
 #ifdef __APPLE__
        else 
        {
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.