From 5c21f232193acde8b65690855799980b34bc5ce4 Mon Sep 17 00:00:00 2001 From: Eberhard Graether Date: Fri, 19 May 2017 14:39:45 +0200 Subject: [PATCH] logic: match source file extensions case insensitive (issue #384) bug id = 384 --- src/lib/utility/file/FileSystem.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/lib/utility/file/FileSystem.cpp b/src/lib/utility/file/FileSystem.cpp index af67e2b9..e8d8751d 100644 --- a/src/lib/utility/file/FileSystem.cpp +++ b/src/lib/utility/file/FileSystem.cpp @@ -5,6 +5,8 @@ #include "boost/date_time.hpp" #include "boost/filesystem.hpp" +#include "utility/utilityString.h" + std::vector FileSystem::getFilePathsFromDirectory( const FilePath& path, const std::vector& extensions ){ @@ -52,7 +54,11 @@ FileInfo FileSystem::getFileInfoForPath(const FilePath& filePath) std::vector FileSystem::getFileInfosFromPaths( const std::vector& paths, const std::vector& fileExtensions, bool followSymLinks ){ - std::set ext(fileExtensions.begin(), fileExtensions.end()); + std::set ext; + for (const std::string& e : fileExtensions) + { + ext.insert(utility::toLowerCase(e)); + } std::set symlinkDirs; std::set filePaths; @@ -99,7 +105,7 @@ std::vector FileSystem::getFileInfosFromPaths( } if (boost::filesystem::is_regular_file(*it) && - (!ext.size() || ext.find(it->path().extension().string()) != ext.end())) + (!ext.size() || ext.find(utility::toLowerCase(it->path().extension().string())) != ext.end())) { boost::filesystem::path p = boost::filesystem::canonical(it->path()); if (filePaths.find(p) != filePaths.end()) @@ -114,7 +120,7 @@ std::vector FileSystem::getFileInfosFromPaths( } } } - else if (path.exists() && (!ext.size() || ext.find(path.extension()) != ext.end())) + else if (path.exists() && (!ext.size() || ext.find(utility::toLowerCase(path.extension())) != ext.end())) { boost::filesystem::path p = boost::filesystem::canonical(path.path()); if (filePaths.find(p) != filePaths.end())