accountDirDelFull.Append(wxT("/.xestiacal/accounts/"));
accountDirDelFull.Append(accountDirFull);
- wxRmDir(accountDirDelFull);
+ DeleteDirectory(accountDirDelFull);
}
reloadAccountConfig = reloadAccountInc;
-}
\ No newline at end of file
+}
+
+void frmPreferences::DeleteDirectory(wxString directoryPath)
+{
+
+ // Open the directory and look for files and directories
+ // to delete.
+
+ wxDir directoryHandle(directoryPath);
+
+ if (!directoryHandle.IsOpened())
+ {
+ return;
+ }
+
+ wxString directoryFilename;
+
+ bool continueProcessing = directoryHandle.GetFirst(&directoryFilename, wxEmptyString, wxDIR_FILES|wxDIR_DIRS|wxDIR_HIDDEN);
+ while (continueProcessing)
+ {
+ wxString directoryFilenameFull = directoryPath + "/" + directoryFilename;
+ if (wxDir::Exists(directoryFilenameFull))
+ {
+ DeleteDirectory(directoryFilenameFull);
+ continueProcessing = directoryHandle.GetNext(&directoryFilename);
+ continue;
+ }
+ wxRemoveFile(directoryFilenameFull);
+ continueProcessing = directoryHandle.GetNext(&directoryFilename);
+ }
+ directoryHandle.Close();
+
+ wxRmDir(directoryPath);
+}
void DeleteAccount( wxCommandEvent& event );
void SavePreferences( wxCommandEvent& event );
void CloseWindow( wxCommandEvent& event );
+ void DeleteDirectory( wxString directoryPath );
public:
/** Constructor */
frmPreferences( wxWindow* parent );