[Scummvm-cvs-logs] scummvm-tools master -> 560f807c2863e57794b84764444b2203c5e9ca8f

criezy criezy at scummvm.org
Mon Nov 21 02:20:42 CET 2011


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm-tools' repo located at https://github.com/scummvm/scummvm-tools .

Summary:
560f807c28 TOOLS: Fix handling of input directory names


Commit: 560f807c2863e57794b84764444b2203c5e9ca8f
    https://github.com/scummvm/scummvm-tools/commit/560f807c2863e57794b84764444b2203c5e9ca8f
Author: Thierry Crozat (criezy at scummvm.org)
Date: 2011-11-20T17:20:15-08:00

Commit Message:
TOOLS: Fix handling of input directory names

The code was supposed to add a '/' at the end of the input directories
provided by the user (if there wasn't one already) but it didn't due to
two different bugs. std::string::operator[] does not change the length
of the string, so it is not a good idea to overwrite '\0' with it. Also the
check to know if the path ended with a '/' was the wrong way out).

Changed paths:
    tool.cpp



diff --git a/tool.cpp b/tool.cpp
index 09569e9..aaf68ef 100644
--- a/tool.cpp
+++ b/tool.cpp
@@ -98,9 +98,8 @@ int Tool::run(const std::deque<std::string> &args) {
 			// Append '/' to input if it's not already done
 			// TODO: We need a way to detect a proper directory here!
 			size_t s = in.size();
-			if (in[s-1] == '/' || in[s-1] == '\\') {
-				in[s] = '/';
-				in[s+1] = '\0';
+			if (in[s-1] != '/' && in[s-1] != '\\') {
+				in.append("/");
 			}
 		}
 






More information about the Scummvm-git-logs mailing list