shell32: shellpath, SHGetFolderPathW()

Rolf Kalbermatter rolf.kalbermatter at citeng.com
Wed Oct 27 18:06:49 CDT 2004


Changelog:
  - dlls/shell32/shellpath.c
    Use SHCreateDirectoryEx function instead of doing explicit
    recursive directory creation

License: X11/LGPL

Rolf Kalbermatter
 
Index: shellpath.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shellpath.c,v
retrieving revision 1.93
diff -u -r1.93 shellpath.c
--- shellpath.c	27 Oct 2004 21:17:30 -0000	1.93
+++ shellpath.c	27 Oct 2004 21:36:52 -0000@@ -1643,7 +1842,7 @@
@@ -1657,39 +1657,16 @@
     }
 
     /* create directory/directories */
-    p = strchrW(szBuildPath, '\\');
-    while (p)
-    {
-        *p = 0;
-        if (!PathFileExistsW(szBuildPath))
-        {
-            TRACE("Creating directory %s\n", debugstr_w(szBuildPath));
-            if (!CreateDirectoryW(szBuildPath,NULL))
-            {
-                ERR("Failed to create directory '%s'.\n",
-                 debugstr_w(szBuildPath));
-                hr = E_FAIL;
-                goto end;
-            }
-        }
-        *p = '\\';
-        p = strchrW(p+1, '\\');
-    }
-    /* last component must be created too. */
-    if (!PathFileExistsW(szBuildPath))
+    if (SHCreateDirectoryExW(hwndOwner, szBuildPath, NULL))
     {
-        if (!CreateDirectoryW(szBuildPath,NULL))
-        {
-            ERR("Failed to create directory '%s'.\n", debugstr_w(szBuildPath));
-            hr = E_FAIL;
-            goto end;
-        }
+        ERR("Failed to create directory '%s'.\n", debugstr_w(szBuildPath));
+        hr = E_FAIL;
+        goto end;
     }
 
     TRACE("Created missing system directory '%s'\n", debugstr_w(szBuildPath));
 end:
-    TRACE("returning 0x%08lx (final path is %s)\n", hr,
-     debugstr_w(szBuildPath));
+    TRACE("returning 0x%08lx (final path is %s)\n", hr, debugstr_w(szBuildPath));
     return hr;
 }
  





More information about the wine-patches mailing list