Relative paths in [Drive] directive

François Gouget fgouget at codeweavers.com
Wed Sep 12 17:09:55 CDT 2001


[Drive C]
"Path" = "fake_windows"

   Currently relative paths specified in a [Drive] section are used as
is. This is doomed to fail since there is no telling what the current
directory will be. This patch makes such paths relative to WINEPREFIX,
which makes it possible to package a config file together with a fake
drive as a self contained unit that you can move around freely.


Changelog:

   François Gouget <fgouget at codeweavers.com>

 * files/drive.c
   Make relative paths of [Drive] sections, relative to WINEPREFIX


-- 
François Gouget
fgouget at codeweavers.com
-------------- next part --------------
Index: files/drive.c
===================================================================
RCS file: /home/wine/wine/files/drive.c,v
retrieving revision 1.58
diff -u -r1.58 drive.c
--- files/drive.c	2001/07/24 21:45:23	1.58
+++ files/drive.c	2001/09/12 18:18:59
@@ -51,6 +51,7 @@
 #include "wine/port.h"
 #include "task.h"
 #include "debugtools.h"
+#include "wine/server.h"
 
 DEFAULT_DEBUG_CHANNEL(dosfs);
 DECLARE_DEBUG_CHANNEL(file);
@@ -170,6 +171,12 @@
         PROFILE_GetWineIniString( name, "Path", "", path, sizeof(path)-1 );
         if (path[0])
         {
+            if (path[0] != '/')
+            {
+                char fullpath[MAX_PATHNAME_LEN];
+                snprintf(fullpath,sizeof(fullpath),"%s/%s",get_config_dir(),path);
+                strcpy(path,fullpath);
+            }
             p = path + strlen(path) - 1;
             while ((p > path) && ((*p == '/') || (*p == '\\'))) *p-- = '\0';
             if (!path[0]) strcpy( path, "/" );


More information about the wine-patches mailing list