James Hawkins : advpack: Run the files test in a temporary directory.

Alexandre Julliard julliard at winehq.org
Mon Jun 30 08:27:32 CDT 2008


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

Author: James Hawkins <jhawkins at codeweavers.com>
Date:   Sun Jun 29 18:17:10 2008 -0500

advpack: Run the files test in a temporary directory.

---

 dlls/advpack/tests/files.c |   23 +++++++++++++++--------
 1 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/dlls/advpack/tests/files.c b/dlls/advpack/tests/files.c
index 530c3b2..d018975 100644
--- a/dlls/advpack/tests/files.c
+++ b/dlls/advpack/tests/files.c
@@ -63,14 +63,6 @@ static void createTestFile(const CHAR *name)
 
 static void create_test_files(void)
 {
-    int len;
-
-    GetCurrentDirectoryA(MAX_PATH, CURR_DIR);
-    len = lstrlenA(CURR_DIR);
-
-    if(len && (CURR_DIR[len-1] == '\\'))
-        CURR_DIR[len-1] = 0;
-
     createTestFile("a.txt");
     createTestFile("b.txt");
     CreateDirectoryA("testdir", NULL);
@@ -528,7 +520,21 @@ static void test_AdvInstallFile(void)
 
 START_TEST(files)
 {
+    DWORD len;
+    char temp_path[MAX_PATH], prev_path[MAX_PATH];
+
     init_function_pointers();
+
+    GetCurrentDirectoryA(MAX_PATH, prev_path);
+    GetTempPath(MAX_PATH, temp_path);
+    SetCurrentDirectoryA(temp_path);
+
+    lstrcpyA(CURR_DIR, temp_path);
+    len = lstrlenA(CURR_DIR);
+
+    if(len && (CURR_DIR[len - 1] == '\\'))
+        CURR_DIR[len - 1] = 0;
+
     create_test_files();
     create_cab_file();
 
@@ -539,4 +545,5 @@ START_TEST(files)
     delete_test_files();
 
     FreeLibrary(hAdvPack);
+    SetCurrentDirectoryA(prev_path);
 }




More information about the wine-cvs mailing list