summaryrefslogtreecommitdiff
path: root/lib/backupstore
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2015-12-17 23:00:55 +0000
committerChris Wilson <chris+github@qwirx.com>2015-12-17 23:00:55 +0000
commit1a91d5f642d6cbbca871cae63ef6b3b1caef068d (patch)
tree5d59e8cdedb4542438308ed3838ea57057815e80 /lib/backupstore
parent1f401115578dfbc06a188735225552818676d9bc (diff)
Fix account deletion on Windows.
Use the rmdir command instead of rm -rf.
Diffstat (limited to 'lib/backupstore')
-rw-r--r--lib/backupstore/BackupStoreAccounts.cpp15
1 files changed, 15 insertions, 0 deletions
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)
{