From 0529b414696b73b0b922da59c03b267d676e35b9 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Wed, 22 Sep 2010 21:12:02 +0000 Subject: Allow restoring directories with a single argument, using the remote name as the local destination name also. --- bin/bbackupquery/BackupQueries.cpp | 29 +++++++++++++++++++++-------- bin/bbackupquery/documentation.txt | 7 +++++-- 2 files changed, 26 insertions(+), 10 deletions(-) (limited to 'bin/bbackupquery') diff --git a/bin/bbackupquery/BackupQueries.cpp b/bin/bbackupquery/BackupQueries.cpp index c7dd82c2..002a9ec4 100644 --- a/bin/bbackupquery/BackupQueries.cpp +++ b/bin/bbackupquery/BackupQueries.cpp @@ -1951,9 +1951,10 @@ void BackupQueries::Compare(int64_t DirID, const std::string &rStoreDir, void BackupQueries::CommandRestore(const std::vector &args, const bool *opts) { // Check arguments - if(args.size() != 2) + if(args.size() < 1 || args.size() > 2) { - BOX_ERROR("Incorrect usage. restore [-drif] "); + BOX_ERROR("Incorrect usage. restore [-drif] " + "[]"); return; } @@ -1994,18 +1995,30 @@ void BackupQueries::CommandRestore(const std::vector &args, const b BOX_ERROR("Directory '" << args[0] << "' not found on server"); return; } + if(dirID == BackupProtocolClientListDirectory::RootDirectory) { BOX_ERROR("Cannot restore the root directory -- restore locations individually."); return; } - -#ifdef WIN32 + std::string localName; - if(!ConvertConsoleToUtf8(args[1].c_str(), localName)) return; -#else - std::string localName(args[1]); -#endif + + if(args.size() == 2) + { + #ifdef WIN32 + if(!ConvertConsoleToUtf8(args[1].c_str(), localName)) + { + return; + } + #else + localName = args[1]; + #endif + } + else + { + localName = args[0]; + } // Go and restore... int result; diff --git a/bin/bbackupquery/documentation.txt b/bin/bbackupquery/documentation.txt index 96eda158..214fe218 100644 --- a/bin/bbackupquery/documentation.txt +++ b/bin/bbackupquery/documentation.txt @@ -119,10 +119,13 @@ compare This can be used for automated tests. < -> restore [-drif] +> restore [-drif] [] Restores a directory to the local disc. The local directory specified - must not exist (unless a previous restore is being restarted). + must not exist (unless a previous restore is being restarted). If the + local directory is omitted, the default is to restore to the same + directory name and path, relative to the current local directory, + as set with the "lcd" command. The root cannot be restored -- restore locations individually. -- cgit v1.2.3