From 79d00c2b36c30b74cc9291d42d5299e37961dce2 Mon Sep 17 00:00:00 2001 From: kelson42 Date: Tue, 1 Nov 2011 12:58:00 +0000 Subject: [PATCH] + small fix to avoid duplicate slashes in paths --- src/common/pathTools.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/pathTools.cpp b/src/common/pathTools.cpp index cbe1158f9..19d618d14 100644 --- a/src/common/pathTools.cpp +++ b/src/common/pathTools.cpp @@ -33,7 +33,7 @@ string computeAbsolutePath(const string path, const string relativePath) { #else string separator = "/"; #endif - string absolutePath = path + "/"; + string absolutePath = path[path.length() - 1] == '/' ? path : path + "/"; char *cRelativePath = strdup(relativePath.c_str()); char *token = strtok(cRelativePath, "/"); @@ -78,7 +78,7 @@ string getLastPathElement(const string &path) { string separator = "/"; #endif - return path.substr(path.find_last_of(separator)); + return path.substr(path.find_last_of(separator) + 1); } unsigned int getFileSize(const string &path) {