advpack: Run the files test in a temporary directory.

This commit is contained in:
James Hawkins 2008-06-29 18:17:10 -05:00 committed by Alexandre Julliard
parent 63ac79f4d5
commit 315e8ce312
1 changed files with 15 additions and 8 deletions

View File

@ -63,14 +63,6 @@ static void createTestFile(const CHAR *name)
static void create_test_files(void) 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("a.txt");
createTestFile("b.txt"); createTestFile("b.txt");
CreateDirectoryA("testdir", NULL); CreateDirectoryA("testdir", NULL);
@ -528,7 +520,21 @@ static void test_AdvInstallFile(void)
START_TEST(files) START_TEST(files)
{ {
DWORD len;
char temp_path[MAX_PATH], prev_path[MAX_PATH];
init_function_pointers(); 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_test_files();
create_cab_file(); create_cab_file();
@ -539,4 +545,5 @@ START_TEST(files)
delete_test_files(); delete_test_files();
FreeLibrary(hAdvPack); FreeLibrary(hAdvPack);
SetCurrentDirectoryA(prev_path);
} }