diff options
author | Chris Wilson <chris+github@qwirx.com> | 2015-12-17 23:00:55 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2015-12-17 23:00:55 +0000 |
commit | 1a91d5f642d6cbbca871cae63ef6b3b1caef068d (patch) | |
tree | 5d59e8cdedb4542438308ed3838ea57057815e80 /lib | |
parent | 1f401115578dfbc06a188735225552818676d9bc (diff) |
Fix account deletion on Windows.
Use the rmdir command instead of rm -rf.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/backupstore/BackupStoreAccounts.cpp | 15 |
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) { |