[RESENT] Don't use ~/.wine/xxx.ini when full path for INI file given

Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Tue Jul 1 15:36:51 CDT 2003


       Changelog:
       wine/files/profile.c: PROFILE_Open
       Don't use ~/.wine/xxx.ini when full path given

This patch makes it possible to run Marco Polo "ReisePlaner Europa" from the
CD (without installation). Without the patch, on the first run, some
~/.wine/standard.ini file is created and when looking for an entry in
<cdrom>\\travel\\prog.mov\\Standard.STA , ~/.wine/standard.ini is used and
nothing is displayed.

-- 
Uwe Bonnes                bon at elektron.ikp.physik.tu-darmstadt.de

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
Index: wine/files/profile.c
===================================================================
RCS file: /home/wine/wine/files/profile.c,v
retrieving revision 1.86
diff -u -7 -r1.86 profile.c
--- wine/files/profile.c	30 Mar 2003 01:35:07 -0000	1.86
+++ wine/files/profile.c	6 May 2003 19:16:49 -0000
@@ -554,14 +553,15 @@
     WCHAR *newdos_name;
     WCHAR *name, *name_lwr;
     char *p;
     FILE *file = NULL;
     int i,j;
     struct stat buf;
     PROFILE *tempProfile;
+    BOOL no_full_name = TRUE;
 
     /* First time around */
 
     if(!CurProfile)
        for(i=0;i<N_CACHED_PROFILES;i++)
          {
           MRUProfile[i]=HeapAlloc( GetProcessHeap(), 0, sizeof(PROFILE) );
@@ -576,14 +576,15 @@
 
     /* Check for a match */
 
     if (strchrW( filename, '/' ) || strchrW( filename, '\\' ) ||
         strchrW( filename, ':' ))
     {
         if (!DOSFS_GetFullName( filename, FALSE, &full_name )) return FALSE;
+        no_full_name = FALSE;
     }
     else
     {
         static const WCHAR bkslashW[] = {'\\',0};
         WCHAR windirW[MAX_PATH];
 
         GetWindowsDirectoryW( windirW, MAX_PATH );
@@ -631,32 +632,36 @@
     /* OK, now that CurProfile is definitely free we assign it our new file */
     newdos_name = HeapAlloc( GetProcessHeap(), 0, (strlenW(full_name.short_name)+1) * sizeof(WCHAR) );
     strcpyW( newdos_name, full_name.short_name );
     CurProfile->dos_name  = newdos_name;
     CurProfile->filename  = HeapAlloc( GetProcessHeap(), 0, (strlenW(filename)+1) * sizeof(WCHAR) );
     strcpyW( CurProfile->filename, filename );
 
-    /* Try to open the profile file, first in $HOME/.wine */
+    /* Try to open the profile file, first in $HOME/.wine , but
+     * only when no full path was given
+     */
 
-    /* FIXME: this will need a more general solution */
-    strcpy( buffer, wine_get_config_dir() );
-    p = buffer + strlen(buffer);
-    *p++ = '/';
-    *p = 0; /* make strlen() below happy */
-    name = strrchrW( newdos_name, '\\' ) + 1;
-
-    /* create a lower cased version of the name */
-    name_lwr = HeapAlloc(GetProcessHeap(), 0, (strlenW(name) + 1) * sizeof(WCHAR));
-    strcpyW(name_lwr, name);
-    strlwrW(name_lwr);
-    WideCharToMultiByte(DRIVE_GetCodepage(full_name.drive), 0, name_lwr, -1,
-                        p, sizeof(buffer) - strlen(buffer), NULL, NULL);
-    HeapFree(GetProcessHeap(), 0, name_lwr);
+    if (no_full_name)
+    {
+        /* FIXME: this will need a more general solution */
+        strcpy( buffer, wine_get_config_dir() );
+        p = buffer + strlen(buffer);
+        *p++ = '/';
+        *p = 0; /* make strlen() below happy */
+        name = strrchrW( newdos_name, '\\' ) + 1;
 
-    if ((file = fopen( buffer, "r" )))
+        /* create a lower cased version of the name */
+        name_lwr = HeapAlloc(GetProcessHeap(), 0, (strlenW(name) + 1) * sizeof(WCHAR));
+        strcpyW(name_lwr, name);
+        strlwrW(name_lwr);
+        WideCharToMultiByte(DRIVE_GetCodepage(full_name.drive), 0, name_lwr, -1,
+	                    p, sizeof(buffer) - strlen(buffer), NULL, NULL);
+        HeapFree(GetProcessHeap(), 0, name_lwr);
+    }
+    if (no_full_name && (file = fopen( buffer, "r" )))
     {
         TRACE("(%s): found it in %s\n", debugstr_w(filename), buffer );
         CurProfile->unix_name = HeapAlloc( GetProcessHeap(), 0, strlen(buffer)+1 );
         strcpy( CurProfile->unix_name, buffer );
     }
     else
     {



More information about the wine-patches mailing list