From: Shane Caraveo Date: Mon, 15 Jan 2001 01:13:51 +0000 (+0000) Subject: clean up temp files X-Git-Tag: php-4.0.5RC1~573 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1d40310fa4b91af309a2d247983dadc9a0b6c535;p=php clean up temp files --- diff --git a/sapi/isapi/stresstest/stresstest.cpp b/sapi/isapi/stresstest/stresstest.cpp index 2b5e5b8380..2324adec39 100644 --- a/sapi/isapi/stresstest/stresstest.cpp +++ b/sapi/isapi/stresstest/stresstest.cpp @@ -315,6 +315,25 @@ BOOL GetTestFiles(const char *path) return IsapiFileList.GetSize() > 0; } +void DeleteTempFiles(const char *mask) +{ + char FindPath[MAX_PATH]; + WIN32_FIND_DATA fd; + memset(&fd, 0, sizeof(WIN32_FIND_DATA)); + + _snprintf(FindPath, sizeof(FindPath)-1, "%s\\%s",temppath, mask); + HANDLE fh = FindFirstFile(FindPath, &fd); + if (fh != INVALID_HANDLE_VALUE) { + do { + char NewFindPath[MAX_PATH]; + _snprintf(NewFindPath, sizeof(NewFindPath)-1, "%s\\%s",temppath, fd.cFileName); + DeleteFile(NewFindPath); + memset(&fd, 0, sizeof(WIN32_FIND_DATA)); + } while (FindNextFile(fh, &fd) != 0); + FindClose(fh); + } +} + void DoTestFiles(const char *filelist, const char *environment) { if (!GetTestFiles(filelist)) { @@ -335,6 +354,12 @@ void DoTestFiles(const char *filelist, const char *environment) TResults result = Results.GetAt(i); printf("%s\r\nOK: %d FAILED: %d\r\n", TestNames.GetAt(i), result.ok, result.bad); } + + // delete temp files + printf("Deleting Temp Files\r\n"); + DeleteTempFiles("exp.*"); + DeleteTempFiles("pht.*"); + printf("Done\r\n"); } int main(int argc, char* argv[]) {