From 1a91d5f642d6cbbca871cae63ef6b3b1caef068d Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Thu, 17 Dec 2015 23:00:55 +0000 Subject: Fix account deletion on Windows. Use the rmdir command instead of rm -rf. --- lib/backupstore/BackupStoreAccounts.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'lib') diff --git a/lib/backupstore/BackupStoreAccounts.cpp b/lib/backupstore/BackupStoreAccounts.cpp index 6650b12a..7955b3c4 100644 --- a/lib/backupstore/BackupStoreAccounts.cpp +++ b/lib/backupstore/BackupStoreAccounts.cpp @@ -418,8 +418,23 @@ int BackupStoreAccountsControl::DeleteAccount(int32_t ID, bool AskForConfirmatio { BOX_NOTICE("Deleting store directory " << (*d) << "..."); // Just use the rm command to delete the files +#ifdef WIN32 + std::string cmd("rmdir /s/q "); + std::string dir = *d; + + // rmdir doesn't understand forward slashes, so replace them all. + for(std::string::iterator i = dir.begin(); i != dir.end(); i++) + { + if(*i == '/') + { + *i = '\\'; + } + } + cmd += dir; +#else std::string cmd("rm -rf "); cmd += *d; +#endif // Run command if(::system(cmd.c_str()) != 0) { -- cgit v1.2.3