From 04c3a7c13d3a9afe8733b4b786f1ac59f26fae7e Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Fri, 27 Jan 2017 19:46:55 +0000 Subject: [PATCH] wxRmDir() diagnostics Logs files remaining, if wxRmDir() failed in our function, RecursivelyRemove. --- src/DirManager.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/DirManager.cpp b/src/DirManager.cpp index ae023463c..2a3a7f1a3 100644 --- a/src/DirManager.cpp +++ b/src/DirManager.cpp @@ -303,7 +303,21 @@ static void RecursivelyRemove(wxArrayString& filePathArray, int count, int bias, if (!bFiles) ::wxRemoveFile(file); // See note above about wxRmdir sometimes incorrectly failing on Windows. #endif - ::wxRmdir(file); + + if (! ::wxRmdir(file) ) { + wxDir dir(file); + if(dir.IsOpened()) { + wxLogMessage(file + wxString(" still contains:")); + wxString name; + auto cont = dir.GetFirst(&name); + while ( cont ) { + wxLogMessage(file + wxString(wxFILE_SEP_PATH) + name ); + cont = dir.GetNext(&name); + } + } + else + wxLogMessage(wxString("Can't enumerate directory ") + file); + } } if (progress) progress->Update(i + bias, count);