src: wstring fixes for clang
This commit is contained in:
+2
-2
@@ -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())
|
||||
{
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
#include "utility/utilityString.h"
|
||||
|
||||
std::vector<FilePath> FileSystem::getFilePathsFromDirectory(
|
||||
const FilePath& path, const std::vector<std::string>& extensions
|
||||
const FilePath& path, const std::vector<std::wstring>& extensions
|
||||
){
|
||||
std::set<std::string> ext(extensions.begin(), extensions.end());
|
||||
std::set<std::wstring> ext(extensions.begin(), extensions.end());
|
||||
std::vector<FilePath> files;
|
||||
|
||||
if (path.isDirectory())
|
||||
@@ -30,7 +30,7 @@ std::vector<FilePath> 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<FileInfo> FileSystem::getFileInfosFromPaths(
|
||||
std::set<std::wstring> ext;
|
||||
for (const std::wstring& e : fileExtensions)
|
||||
{
|
||||
ext.insert(utility::toLowerCase(e));
|
||||
// ext.insert(utility::toLowerCase(e));
|
||||
ext.insert(e);
|
||||
}
|
||||
|
||||
std::set<boost::filesystem::path> symlinkDirs;
|
||||
|
||||
@@ -12,7 +12,7 @@ class FileSystem
|
||||
{
|
||||
public:
|
||||
static std::vector<FilePath> getFilePathsFromDirectory(
|
||||
const FilePath& path, const std::vector<std::string>& extensions = {});
|
||||
const FilePath& path, const std::vector<std::wstring>& extensions = {});
|
||||
|
||||
static FileInfo getFileInfoForPath(const FilePath& filePath);
|
||||
|
||||
|
||||
@@ -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<std::string> extensions;
|
||||
std::vector<std::wstring> extensions;
|
||||
extensions.push_back(extension);
|
||||
std::vector<FilePath> fontFilePaths = FileSystem::getFilePathsFromDirectory(path, extensions);
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ QtProjectWizzardContentPreferences::QtProjectWizzardContentPreferences(
|
||||
, m_screenScaleFactor(nullptr)
|
||||
{
|
||||
m_colorSchemePaths =
|
||||
FileSystem::getFilePathsFromDirectory(ResourcePaths::getColorSchemesPath(), std::vector<std::string>(1, ".xml"));
|
||||
FileSystem::getFilePathsFromDirectory(ResourcePaths::getColorSchemesPath(), { L".xml" });
|
||||
}
|
||||
|
||||
QtProjectWizzardContentPreferences::~QtProjectWizzardContentPreferences()
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ std::vector<FilePath> 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);
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ std::vector<FilePath> SourceGroupJavaGradle::doGetClassPath() const
|
||||
{
|
||||
std::vector<FilePath> 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()
|
||||
);
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ std::vector<FilePath> SourceGroupJavaMaven::doGetClassPath() const
|
||||
{
|
||||
std::vector<FilePath> mavenJarPaths = FileSystem::getFilePathsFromDirectory(
|
||||
m_settings->getMavenDependenciesDirectoryExpandedAndAbsolute(),
|
||||
utility::createVectorFromElements<std::string>(".jar")
|
||||
{ L".jar" }
|
||||
);
|
||||
|
||||
for (const FilePath& mavenJarPath : mavenJarPaths)
|
||||
|
||||
@@ -14,9 +14,15 @@ public:
|
||||
sourcePaths.push_back(FilePath(L"./data/FileManagerTestSuite/include/"));
|
||||
std::vector<FilePath> headerPaths;
|
||||
std::vector<FilePath> 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<std::wstring> sourceExtensions = { L".cpp", L".c", specialExtension };
|
||||
|
||||
FileManager fm;
|
||||
@@ -27,6 +33,5 @@ public:
|
||||
TS_ASSERT(utility::containsElement<FilePath>(filePaths, FilePath(L"./data/FileManagerTestSuite/src/a.cpp")));
|
||||
TS_ASSERT(utility::containsElement<FilePath>(filePaths, FilePath(L"./data/FileManagerTestSuite/src/d.c")));
|
||||
TS_ASSERT(utility::containsElement<FilePath>(filePaths, FilePath(L"./data/FileManagerTestSuite/src/e" + specialExtension)));
|
||||
int ee = 0;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -13,11 +13,8 @@ class FileSystemTestSuite: public CxxTest::TestSuite
|
||||
public:
|
||||
void test_find_cpp_files()
|
||||
{
|
||||
std::vector<std::string> extensions;
|
||||
extensions.push_back(".cpp");
|
||||
|
||||
std::vector<std::wstring> cppFiles = utility::convert<FilePath, std::wstring>(
|
||||
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<std::string> extensions;
|
||||
extensions.push_back(".h");
|
||||
|
||||
std::vector<std::wstring> headerFiles = utility::convert<FilePath, std::wstring>(
|
||||
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<std::string> extensions;
|
||||
extensions.push_back(".h");
|
||||
extensions.push_back(".hpp");
|
||||
extensions.push_back(".cpp");
|
||||
|
||||
std::vector<std::string> sourceFiles = utility::convert<FilePath, std::string>(
|
||||
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<std::string> extensions;
|
||||
extensions.push_back(".h");
|
||||
extensions.push_back(".hpp");
|
||||
extensions.push_back(".cpp");
|
||||
|
||||
std::vector<FilePath> directoryPaths;
|
||||
directoryPaths.push_back(FilePath(L"./data/FileSystemTestSuite/src"));
|
||||
|
||||
std::vector<FileInfo> files = FileSystem::getFileInfosFromPaths(directoryPaths, extensions, false);
|
||||
std::vector<FileInfo> 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<std::string> extensions;
|
||||
extensions.push_back(".h");
|
||||
extensions.push_back(".hpp");
|
||||
extensions.push_back(".cpp");
|
||||
|
||||
std::vector<FilePath> directoryPaths;
|
||||
directoryPaths.push_back(FilePath(L"./data/FileSystemTestSuite/src"));
|
||||
|
||||
std::vector<FileInfo> files = FileSystem::getFileInfosFromPaths(directoryPaths, extensions, true);
|
||||
std::vector<FileInfo> 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",
|
||||
|
||||
Reference in New Issue
Block a user