diff --git a/src/app/main.cpp b/src/app/main.cpp index efcc2756..04e592e6 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -320,8 +320,8 @@ int main(int argc, char *argv[]) prefillPaths(); addLanguageModules(); - utility::loadFontsFromDirectory(ResourcePaths::getFontsPath(), ".otf"); - utility::loadFontsFromDirectory(ResourcePaths::getFontsPath(), ".ttf"); + utility::loadFontsFromDirectory(ResourcePaths::getFontsPath(), L".otf"); + utility::loadFontsFromDirectory(ResourcePaths::getFontsPath(), L".ttf"); if (commandLineParser.hasError()) { diff --git a/src/lib/utility/file/FileSystem.cpp b/src/lib/utility/file/FileSystem.cpp index a33d6db6..85d7b868 100644 --- a/src/lib/utility/file/FileSystem.cpp +++ b/src/lib/utility/file/FileSystem.cpp @@ -8,9 +8,9 @@ #include "utility/utilityString.h" std::vector FileSystem::getFilePathsFromDirectory( - const FilePath& path, const std::vector& extensions + const FilePath& path, const std::vector& extensions ){ - std::set ext(extensions.begin(), extensions.end()); + std::set ext(extensions.begin(), extensions.end()); std::vector files; if (path.isDirectory()) @@ -30,7 +30,7 @@ std::vector FileSystem::getFilePathsFromDirectory( } } - if (boost::filesystem::is_regular_file(*it) && (ext.empty() || ext.find(it->path().extension().string()) != ext.end())) + if (boost::filesystem::is_regular_file(*it) && (ext.empty() || ext.find(it->path().extension().wstring()) != ext.end())) { files.push_back(FilePath(it->path().generic_wstring())); } @@ -55,7 +55,8 @@ std::vector FileSystem::getFileInfosFromPaths( std::set ext; for (const std::wstring& e : fileExtensions) { - ext.insert(utility::toLowerCase(e)); + // ext.insert(utility::toLowerCase(e)); + ext.insert(e); } std::set symlinkDirs; diff --git a/src/lib/utility/file/FileSystem.h b/src/lib/utility/file/FileSystem.h index 180cae97..227f3db4 100644 --- a/src/lib/utility/file/FileSystem.h +++ b/src/lib/utility/file/FileSystem.h @@ -12,7 +12,7 @@ class FileSystem { public: static std::vector getFilePathsFromDirectory( - const FilePath& path, const std::vector& extensions = {}); + const FilePath& path, const std::vector& extensions = {}); static FileInfo getFileInfoForPath(const FilePath& filePath); diff --git a/src/lib_gui/qt/utility/utilityQt.cpp b/src/lib_gui/qt/utility/utilityQt.cpp index 3f91a95d..7988e2fe 100644 --- a/src/lib_gui/qt/utility/utilityQt.cpp +++ b/src/lib_gui/qt/utility/utilityQt.cpp @@ -37,9 +37,9 @@ namespace utility widget->setSizePolicy(pol); } - void loadFontsFromDirectory(const FilePath& path, const std::string& extension) + void loadFontsFromDirectory(const FilePath& path, const std::wstring& extension) { - std::vector extensions; + std::vector extensions; extensions.push_back(extension); std::vector fontFilePaths = FileSystem::getFilePathsFromDirectory(path, extensions); diff --git a/src/lib_gui/qt/utility/utilityQt.h b/src/lib_gui/qt/utility/utilityQt.h index 57ad499b..bb0ba3b3 100644 --- a/src/lib_gui/qt/utility/utilityQt.h +++ b/src/lib_gui/qt/utility/utilityQt.h @@ -15,7 +15,7 @@ namespace utility void setWidgetBackgroundColor(QWidget* widget, const std::string& color); void setWidgetRetainsSpaceWhenHidden(QWidget* widget); - void loadFontsFromDirectory(const FilePath& path, const std::string& extension = ".otf"); + void loadFontsFromDirectory(const FilePath& path, const std::wstring& extension = L".otf"); std::string getStyleSheet(const FilePath& path); diff --git a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPreferences.cpp b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPreferences.cpp index bc139f40..a1ae9ed8 100644 --- a/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPreferences.cpp +++ b/src/lib_gui/qt/window/project_wizzard/QtProjectWizzardContentPreferences.cpp @@ -26,7 +26,7 @@ QtProjectWizzardContentPreferences::QtProjectWizzardContentPreferences( , m_screenScaleFactor(nullptr) { m_colorSchemePaths = - FileSystem::getFilePathsFromDirectory(ResourcePaths::getColorSchemesPath(), std::vector(1, ".xml")); + FileSystem::getFilePathsFromDirectory(ResourcePaths::getColorSchemesPath(), { L".xml" }); } QtProjectWizzardContentPreferences::~QtProjectWizzardContentPreferences() diff --git a/src/lib_gui/utility/path_detector/jre_system_library/JreSystemLibraryPathDetector.cpp b/src/lib_gui/utility/path_detector/jre_system_library/JreSystemLibraryPathDetector.cpp index e259acc5..92f7a577 100644 --- a/src/lib_gui/utility/path_detector/jre_system_library/JreSystemLibraryPathDetector.cpp +++ b/src/lib_gui/utility/path_detector/jre_system_library/JreSystemLibraryPathDetector.cpp @@ -22,7 +22,7 @@ std::vector JreSystemLibraryPathDetector::getPaths() const for (const FilePath& jrePath: m_javaPathDetector->getPaths()) { const FilePath javaRoot = jrePath.getParentDirectory().getParentDirectory().getParentDirectory(); - for (const FilePath& jarPath : FileSystem::getFilePathsFromDirectory(javaRoot.getConcatenated(L"lib"), {".jar"})) + for (const FilePath& jarPath : FileSystem::getFilePathsFromDirectory(javaRoot.getConcatenated(L"lib"), { L".jar" })) { paths.push_back(jarPath); } diff --git a/src/lib_java/project/SourceGroupJavaGradle.cpp b/src/lib_java/project/SourceGroupJavaGradle.cpp index b1a18b0f..bbb9c8f5 100644 --- a/src/lib_java/project/SourceGroupJavaGradle.cpp +++ b/src/lib_java/project/SourceGroupJavaGradle.cpp @@ -46,7 +46,7 @@ std::vector SourceGroupJavaGradle::doGetClassPath() const { std::vector gradleJarPaths = FileSystem::getFilePathsFromDirectory( m_settings->getGradleDependenciesDirectoryExpandedAndAbsolute(), - {".jar"} + { L".jar" } ); for (const FilePath& gradleJarPath : gradleJarPaths) @@ -97,12 +97,12 @@ bool SourceGroupJavaGradle::prepareGradleData() ScopedFunctor dialogHider([&dialogView]() { dialogView->hideUnknownProgressDialog(); }); - + dialogView->showUnknownProgressDialog("Preparing Project", "Gradle\nExporting Dependencies"); bool success = utility::gradleCopyDependencies( - projectRootPath, - m_settings->getGradleDependenciesDirectoryExpandedAndAbsolute(), + projectRootPath, + m_settings->getGradleDependenciesDirectoryExpandedAndAbsolute(), m_settings->getShouldIndexGradleTests() ); diff --git a/src/lib_java/project/SourceGroupJavaMaven.cpp b/src/lib_java/project/SourceGroupJavaMaven.cpp index 396028a8..feef48fa 100644 --- a/src/lib_java/project/SourceGroupJavaMaven.cpp +++ b/src/lib_java/project/SourceGroupJavaMaven.cpp @@ -46,7 +46,7 @@ std::vector SourceGroupJavaMaven::doGetClassPath() const { std::vector mavenJarPaths = FileSystem::getFilePathsFromDirectory( m_settings->getMavenDependenciesDirectoryExpandedAndAbsolute(), - utility::createVectorFromElements(".jar") + { L".jar" } ); for (const FilePath& mavenJarPath : mavenJarPaths) diff --git a/src/test/FileManagerTestSuite.h b/src/test/FileManagerTestSuite.h index 989d939b..685745b8 100644 --- a/src/test/FileManagerTestSuite.h +++ b/src/test/FileManagerTestSuite.h @@ -14,9 +14,15 @@ public: sourcePaths.push_back(FilePath(L"./data/FileManagerTestSuite/include/")); std::vector headerPaths; std::vector excludePaths; - const wchar_t specialCharacter(252); std::wstring specialExtension = L"."; +#ifdef _WIN32 + const wchar_t specialCharacter(252); specialExtension += specialCharacter; +#else + std::wstring c; + specialExtension += wchar_t(117); + specialExtension += wchar_t(776); +#endif std::vector sourceExtensions = { L".cpp", L".c", specialExtension }; FileManager fm; @@ -27,6 +33,5 @@ public: TS_ASSERT(utility::containsElement(filePaths, FilePath(L"./data/FileManagerTestSuite/src/a.cpp"))); TS_ASSERT(utility::containsElement(filePaths, FilePath(L"./data/FileManagerTestSuite/src/d.c"))); TS_ASSERT(utility::containsElement(filePaths, FilePath(L"./data/FileManagerTestSuite/src/e" + specialExtension))); - int ee = 0; } }; diff --git a/src/test/FileSystemTestSuite.h b/src/test/FileSystemTestSuite.h index 8e9d6cf9..b0f8d91f 100644 --- a/src/test/FileSystemTestSuite.h +++ b/src/test/FileSystemTestSuite.h @@ -13,11 +13,8 @@ class FileSystemTestSuite: public CxxTest::TestSuite public: void test_find_cpp_files() { - std::vector extensions; - extensions.push_back(".cpp"); - std::vector cppFiles = utility::convert( - FileSystem::getFilePathsFromDirectory(FilePath(L"data/FileSystemTestSuite"), extensions), + FileSystem::getFilePathsFromDirectory(FilePath(L"data/FileSystemTestSuite"), { L".cpp" }), [](const FilePath& filePath){ return filePath.wstr(); } ); @@ -30,11 +27,8 @@ public: void test_find_h_files() { - std::vector extensions; - extensions.push_back(".h"); - std::vector headerFiles = utility::convert( - FileSystem::getFilePathsFromDirectory(FilePath("data/FileSystemTestSuite"), extensions), + FileSystem::getFilePathsFromDirectory(FilePath("data/FileSystemTestSuite"), { L".h" }), [](const FilePath& filePath){ return filePath.wstr(); } ); @@ -46,13 +40,8 @@ public: void test_find_all_source_files() { - std::vector extensions; - extensions.push_back(".h"); - extensions.push_back(".hpp"); - extensions.push_back(".cpp"); - std::vector sourceFiles = utility::convert( - FileSystem::getFilePathsFromDirectory(FilePath(L"data/FileSystemTestSuite"), extensions), + FileSystem::getFilePathsFromDirectory(FilePath(L"data/FileSystemTestSuite"), { L".h", L".hpp", L".cpp" }), [](const FilePath& filePath){ return filePath.str(); } ); @@ -62,15 +51,10 @@ public: void test_find_file_infos() { #ifndef _WIN32 - std::vector extensions; - extensions.push_back(".h"); - extensions.push_back(".hpp"); - extensions.push_back(".cpp"); - std::vector directoryPaths; directoryPaths.push_back(FilePath(L"./data/FileSystemTestSuite/src")); - std::vector files = FileSystem::getFileInfosFromPaths(directoryPaths, extensions, false); + std::vector files = FileSystem::getFileInfosFromPaths(directoryPaths, { L".h", L".hpp", L".cpp" }, false); TS_ASSERT_EQUALS(files.size(), 2); TS_ASSERT(isInFileInfos(files, L"./data/FileSystemTestSuite/src/test.cpp")); @@ -81,15 +65,10 @@ public: void test_find_file_infos_with_symlinks() { #ifndef _WIN32 - std::vector extensions; - extensions.push_back(".h"); - extensions.push_back(".hpp"); - extensions.push_back(".cpp"); - std::vector directoryPaths; directoryPaths.push_back(FilePath(L"./data/FileSystemTestSuite/src")); - std::vector files = FileSystem::getFileInfosFromPaths(directoryPaths, extensions, true); + std::vector files = FileSystem::getFileInfosFromPaths(directoryPaths, { L".h", L".hpp", L".cpp" }, true); TS_ASSERT_EQUALS(files.size(), 5); TS_ASSERT(isInFileInfos(files, L"./data/FileSystemTestSuite/src/Settings/player.h",