Alexandre Julliard : shell32/tests: Create our own temp directory to make sure it's not the Windows directory.

Alexandre Julliard julliard at winehq.org
Thu Jul 23 09:59:26 CDT 2009


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Jul 22 23:25:25 2009 +0200

shell32/tests: Create our own temp directory to make sure it's not the Windows directory.

---

 dlls/shell32/tests/shlexec.c |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/dlls/shell32/tests/shlexec.c b/dlls/shell32/tests/shlexec.c
index 6edc926..5f0776a 100644
--- a/dlls/shell32/tests/shlexec.c
+++ b/dlls/shell32/tests/shlexec.c
@@ -864,8 +864,7 @@ static void test_find_executable(void)
     ok(rc == SE_ERR_NOASSOC /* >= win2000 */ || rc > 32 /* win98, nt4 */, "FindExecutable(NULL) returned %ld\n", rc);
     ok(strcmp(command, "your word") != 0, "FindExecutable(NULL) returned command=[%s]\n", command);
 
-    /* Win95 can't cope with double backslashes in FindExecutableA (tmpdir has a trailing backslash) */
-    sprintf(filename, "%stest file.sfe", tmpdir);
+    sprintf(filename, "%s\\test file.sfe", tmpdir);
     rc=(INT_PTR)FindExecutableA(filename, NULL, command);
     ok(rc > 32, "FindExecutable(%s) returned %ld\n", filename, rc);
     /* Depending on the platform, command could be '%1' or 'test file.sfe' */
@@ -911,10 +910,6 @@ static void test_find_executable(void)
     test=filename_tests;
     while (test->basename)
     {
-        /* Win95 can't cope with double slashes/backslashes in FindExecutableA */
-        if (tmpdir[strlen(tmpdir) - 1] == '\\')
-            tmpdir[strlen(tmpdir) - 1] = 0;
-
         sprintf(filename, test->basename, tmpdir);
         if (strchr(filename, '/'))
         {
@@ -1527,8 +1522,13 @@ static void init_test(void)
            "unable to find argv0!\n");
     }
 
-    GetTempPathA(sizeof(tmpdir)/sizeof(*tmpdir), tmpdir);
-    assert(GetTempFileNameA(tmpdir, "wt", 0, child_file)!=0);
+    GetTempPathA(sizeof(filename), filename);
+    GetTempFileNameA(filename, "wt", 0, tmpdir);
+    DeleteFileA( tmpdir );
+    rc = CreateDirectoryA( tmpdir, NULL );
+    ok( rc, "failed to create %s err %u\n", tmpdir, GetLastError() );
+    rc = GetTempFileNameA(tmpdir, "wt", 0, child_file);
+    assert(rc != 0);
     init_event(child_file);
 
     /* Set up the test files */
@@ -1608,6 +1608,7 @@ static void cleanup_test(void)
         testfile++;
     }
     DeleteFile(child_file);
+    RemoveDirectoryA(tmpdir);
 
     /* Delete the test association */
     delete_test_association(".shlexec");




More information about the wine-cvs mailing list