Re: DOSFS_FindUnixName and "unix" filesystem (was: Re: (HELP) ...)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am Don, 2002-08-29 um 03.25 schrieb Alexandre Julliard:
 
> I'd say that DOSFS_ToDosFCBFormat should fail when the file contains
> upper-case chars on a case-sensitive file system. This will probably
> make it impossible to access some files in certain cases though. I'm
> afraid it's not possible to support case-sensitive file systems 100%
> right given that Windows apps don't preserve case correctly.

I propose another patch with is is IMO the least intrusive:

- changes nothing for non-"unix" filesystems
- for "unix", searches the whole directory for exact matches first,
  then again for DOS matches; i.e. DOS matches will be used, but only
  if there are no exact ones.

Sorry the patch is difficult to read - you'll see the point if you
compare the patched an non-patched versions visually.

In any case this is relatively minor and we can live without. If we
don't patch, we need to be prepared that other people stumble into the
problem I had, though. I am still feeling dumb - my wine development was
practically stuck for 2 months because of that "wine" file.

Martin

Index: dos_fs.c
===================================================================
RCS file: /home/wine/wine/files/dos_fs.c,v
retrieving revision 1.117
diff -u -r1.117 dos_fs.c
--- dos_fs.c	27 Aug 2002 01:13:59 -0000	1.117
+++ dos_fs.c	29 Aug 2002 08:34:51 -0000
@@ -746,31 +746,53 @@
         return FALSE;
     }
 
-    while ((ret = DOSFS_ReadDir( dir, &long_name, &short_name )))
+    if (ignore_case)
     {
-        /* Check against Unix name */
-        if (len == strlenW(long_name))
+        while ((ret = DOSFS_ReadDir( dir, &long_name, &short_name )))
         {
-            if (!ignore_case)
+            /* Check against Unix name */
+            if (len == strlenW(long_name) && !strncmpiW( long_name, name, len ))
+                goto found;
+
+            if (dos_name[0])
             {
-                if (!strncmpW( long_name, name, len )) break;
-            }
-            else
-            {
-                if (!strncmpiW( long_name, name, len )) break;
+                /* Check against hashed DOS name */
+                if (!short_name)
+                {
+                    DOSFS_Hash( long_name, tmp_buf, TRUE, ignore_case );
+                    short_name = tmp_buf;
+                }
+                if (!strcmpW( dos_name, short_name )) goto found;
             }
         }
-        if (dos_name[0])
+    }
+    else /* ignore_case ("unix" file system): try to find exact match first */
+    {
+        while ((ret = DOSFS_ReadDir( dir, &long_name, &short_name )))
+            if (len == strlenW(long_name) && !strncmpW( long_name, name, len ))
+                goto found;
+
+        DOSFS_CloseDir( dir );
+        dir = DOSFS_OpenDir( DRIVE_GetCodepage(path->drive), path->long_name );
+
+        while ((ret = DOSFS_ReadDir( dir, &long_name, &short_name )))
         {
-            /* Check against hashed DOS name */
-            if (!short_name)
+            if (dos_name[0])
             {
-                DOSFS_Hash( long_name, tmp_buf, TRUE, ignore_case );
-                short_name = tmp_buf;
+                /* Check against hashed DOS name */
+                if (!short_name)
+                {
+                    DOSFS_Hash( long_name, tmp_buf, TRUE, ignore_case );
+                    short_name = tmp_buf;
+                }
+                if (!strcmpW( dos_name, short_name )) goto found;
             }
-            if (!strcmpW( dos_name, short_name )) break;
         }
     }
+
+found:
+    DOSFS_CloseDir( dir );
+
     if (ret)
     {
         if (long_buf) WideCharToMultiByte(DRIVE_GetCodepage(path->drive), 0,
@@ -787,7 +809,6 @@
     }
     else
         WARN("%s not found in '%s'\n", debugstr_w(name), path->long_name);
-    DOSFS_CloseDir( dir );
     return ret;
 }
 

-- 
Martin Wilck                Phone: +49 5251 8 15113
Fujitsu Siemens Computers   Fax:   +49 5251 8 20409
Heinz-Nixdorf-Ring 1	    mailto:Martin.Wilck@Fujitsu-Siemens.com
D-33106 Paderborn           http://www.fujitsu-siemens.com/primergy







[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux