Francois Gouget : shell32/tests: Fix test_GetDisplayName() to cope with a left-over test directory.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Feb 9 08:22:14 CST 2007


Module: wine
Branch: master
Commit: f97a2f9def0724d4810b7094859d16090aad5f40
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=f97a2f9def0724d4810b7094859d16090aad5f40

Author: Francois Gouget <fgouget at free.fr>
Date:   Fri Feb  9 12:41:08 2007 +0100

shell32/tests: Fix test_GetDisplayName() to cope with a left-over test directory.

---

 dlls/shell32/tests/shlfolder.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/dlls/shell32/tests/shlfolder.c b/dlls/shell32/tests/shlfolder.c
index 714652f..389d18b 100644
--- a/dlls/shell32/tests/shlfolder.c
+++ b/dlls/shell32/tests/shlfolder.c
@@ -338,6 +338,7 @@ static void test_GetDisplayName(void)
     HANDLE hTestFile;
     WCHAR wszTestFile[MAX_PATH], wszTestFile2[MAX_PATH], wszTestDir[MAX_PATH];
     char szTestFile[MAX_PATH], szTestDir[MAX_PATH];
+    DWORD attr;
     STRRET strret;
     LPSHELLFOLDER psfDesktop, psfPersonal;
     IUnknown *psfFile;
@@ -364,10 +365,15 @@ static void test_GetDisplayName(void)
 
     PathAddBackslashW(wszTestDir);
     lstrcatW(wszTestDir, wszDirName);
+    /* Use ANSI file functions so this works on Windows 9x */
     WideCharToMultiByte(CP_ACP, 0, wszTestDir, -1, szTestDir, MAX_PATH, 0, 0);
-    result = CreateDirectoryA(szTestDir, NULL);
-    ok(result, "CreateDirectoryA failed! Last error: %u\n", GetLastError());
-    if (!result) return;
+    CreateDirectoryA(szTestDir, NULL);
+    attr=GetFileAttributesA(szTestDir);
+    if (attr == INVALID_FILE_ATTRIBUTES || !(attr & FILE_ATTRIBUTE_DIRECTORY))
+    {
+        ok(0, "unable to create the '%s' directory\n", szTestDir);
+        return;
+    }
 
     lstrcpyW(wszTestFile, wszTestDir);
     PathAddBackslashW(wszTestFile);




More information about the wine-cvs mailing list