Message: 1 Date: Wed, 22 Oct 2003 10:10:58 +0200 From: Jakob Eriksson jakov@vmlinux.org To: dpaun@rogers.com CC: Ferenc Wagner wferi@afavant.elte.hu, wine-devel@winehq.org Subject: Re: winetests: new addition
My thought exactly. I also tried to write a recursive delete using plain Win32 but failed miserably. :-)
You mean something like this: (Stolen shamelessly and a little modified fror SHELL_DeleteDirectory in shlfileop.c)
#define IsDotDir(x) ((x[0] == '.') && ((x[1] == 0) || ((x[1] == '.') && (x[2] == 0))))
static BOOL removeDir(LPCSTR dir) { BOOL ret = TRUE; HANDLE hFind; WIN32_FIND_DATAA wfd; CHAR path[MAX_PATH];
/* Make sure the directory exists before going further */ PathCombineA(path, dir, "*"); hFind = FindFirstFileA(path, &wfd); if (hFind == INVALID_HANDLE_VALUE) return ret;
do { LPSTR lp = wfd.cFileName; if (!lp[0]) lp = wfd.cAlternateFileName; if (IsDotDir(lp)) continue; PathCombineA(path, dir, lp); if (FILE_ATTRIBUTE_DIRECTORY & wfd.dwFileAttributes) { ret = removeDir(path); } else ret = DeleteFileA(path); } while (ret && FindNextFileA(hFind, &wfd)); FindClose(hFind); RemoveDirectoryA(dir); return ret; }
Rolf Kalbermatter