[Box Backup-commit] COMMIT r1047 - box/chris/general/bin/bbackupquery

boxbackup-dev@fluffy.co.uk boxbackup-dev@fluffy.co.uk
Sun, 15 Oct 2006 19:44:06 +0100


Author: chris
Date: 2006-10-15 19:44:06 +0100 (Sun, 15 Oct 2006)
New Revision: 1047

Modified:
   box/chris/general/bin/bbackupquery/BackupQueries.cpp
   box/chris/general/bin/bbackupquery/BackupQueries.h
Log:
Convert both arguments of the Get command to local encoding, to support
local paths in local encoding.


Modified: box/chris/general/bin/bbackupquery/BackupQueries.cpp
===================================================================
--- box/chris/general/bin/bbackupquery/BackupQueries.cpp	2006-10-15 18:43:09 UTC (rev 1046)
+++ box/chris/general/bin/bbackupquery/BackupQueries.cpp	2006-10-15 18:44:06 UTC (rev 1047)
@@ -890,7 +890,7 @@
 //		Created: 2003/10/12
 //
 // --------------------------------------------------------------------------
-void BackupQueries::CommandGet(const std::vector<std::string> &args, const bool *opts)
+void BackupQueries::CommandGet(std::vector<std::string> args, const bool *opts)
 {
 	// At least one argument?
 	// Check args
@@ -910,13 +910,21 @@
 	// BLOCK
 	{
 #ifdef WIN32
-		std::string fileName;
-		if(!ConvertConsoleToUtf8(args[0].c_str(), fileName))
-			return;
-#else
-		std::string fileName(args[0]);
+		for (std::vector<std::string>::iterator 
+			i = args.begin(); i != args.end(); i++)
+		{
+			std::string out;
+			if(!ConvertConsoleToUtf8(i->c_str(), out))
+			{
+				fprintf(stderr, "failed to convert encoding\n");
+				return;
+			}
+			*i = out;
+		}
 #endif
 
+		std::string fileName(args[0]);
+
 		if(!opts['i'])
 		{
 			// does this remote filename include a path?

Modified: box/chris/general/bin/bbackupquery/BackupQueries.h
===================================================================
--- box/chris/general/bin/bbackupquery/BackupQueries.h	2006-10-15 18:43:09 UTC (rev 1046)
+++ box/chris/general/bin/bbackupquery/BackupQueries.h	2006-10-15 18:44:06 UTC (rev 1047)
@@ -50,7 +50,7 @@
 	void CommandChangeDir(const std::vector<std::string> &args, const bool *opts);
 	void CommandChangeLocalDir(const std::vector<std::string> &args);
 	void CommandGetObject(const std::vector<std::string> &args, const bool *opts);
-	void CommandGet(const std::vector<std::string> &args, const bool *opts);
+	void CommandGet(std::vector<std::string> args, const bool *opts);
 	void CommandCompare(const std::vector<std::string> &args, const bool *opts);
 	void CommandRestore(const std::vector<std::string> &args, const bool *opts);
 	void CommandUndelete(const std::vector<std::string> &args, const bool *opts);