diff --git a/cli/cmdlineparser.cpp b/cli/cmdlineparser.cpp index 96a5dc736..94571984d 100644 --- a/cli/cmdlineparser.cpp +++ b/cli/cmdlineparser.cpp @@ -77,7 +77,7 @@ static void AddInclPathsToList(const std::string& FileList, std::listpush_back(PathName); @@ -426,7 +426,7 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[]) path = Path::fromNativeSeparators(path); // If path doesn't end with / or \, add it - if (path.back() != '/') + if (!endsWith(path,'/')) path += '/'; _settings->includePaths.push_back(path); @@ -480,7 +480,7 @@ bool CmdLineParser::ParseFromArgs(int argc, const char* const argv[]) if (FileLister::isDirectory(path)) { // If directory name doesn't end with / or \, add it - if (path.back() != '/') + if (!endsWith(path, '/')) path += '/'; } _ignoredPaths.push_back(path); diff --git a/cli/filelister.cpp b/cli/filelister.cpp index 5eb9fb8d7..fe5a45317 100644 --- a/cli/filelister.cpp +++ b/cli/filelister.cpp @@ -20,6 +20,7 @@ #include "path.h" #include "pathmatch.h" +#include "utils.h" #include #include @@ -228,7 +229,7 @@ void FileLister::addFiles(std::map &files, const std:: { if (!path.empty()) { std::string corrected_path = path; - if (corrected_path.back() == '/') + if (endsWith(corrected_path, '/')) corrected_path.erase(corrected_path.end() - 1); addFiles2(files, corrected_path, extra, recursive, ignored);