logic: used wstring in FilePath constructor
* used wstring in FilePath constructor where easily possible * added FilePath concatenate method that accepts string parameter * implemented using only wstring in MessageStatus * used wstring in config
This commit is contained in:
@@ -65,7 +65,7 @@ bool ApplicationSettings::load(const FilePath& filePath)
|
||||
{
|
||||
License license;
|
||||
bool isLoaded = license.loadFromEncodedString(
|
||||
migration->getValueFromSettings<std::string>(settings, "user/license/license", ""), AppPath::getAppPath());
|
||||
migration->getValueFromSettings<std::string>(settings, "user/license/license", ""), AppPath::getAppPath().str());
|
||||
if (isLoaded && license.isValid() && license.isNonCommercialLicenseType())
|
||||
{
|
||||
migration->removeValuesInSettings(settings, "user/license/license");
|
||||
@@ -149,8 +149,8 @@ void ApplicationSettings::setShowBuiltinTypesInGraph(bool showBuiltinTypes)
|
||||
|
||||
FilePath ApplicationSettings::getColorSchemePath() const
|
||||
{
|
||||
FilePath defaultPath(ResourcePaths::getColorSchemesPath().concatenate(FilePath("bright.xml")));
|
||||
FilePath path(getValue<std::string>("application/color_scheme", defaultPath.str()));
|
||||
FilePath defaultPath(ResourcePaths::getColorSchemesPath().concatenate(L"bright.xml"));
|
||||
FilePath path(getValue<std::wstring>("application/color_scheme", defaultPath.wstr()));
|
||||
|
||||
if (path != defaultPath && !path.exists())
|
||||
{
|
||||
@@ -305,14 +305,14 @@ void ApplicationSettings::setMultiProcessIndexingEnabled(bool enabled)
|
||||
setValue<bool>("indexing/multi_process_indexing", enabled);
|
||||
}
|
||||
|
||||
std::string ApplicationSettings::getJavaPath() const
|
||||
FilePath ApplicationSettings::getJavaPath() const
|
||||
{
|
||||
return getValue<std::string>("indexing/java/java_path", "");
|
||||
return FilePath(getValue<std::wstring>("indexing/java/java_path", L""));
|
||||
}
|
||||
|
||||
void ApplicationSettings::setJavaPath(const FilePath& path)
|
||||
{
|
||||
setValue<std::string>("indexing/java/java_path", path.str());
|
||||
setValue<std::wstring>("indexing/java/java_path", path.wstr());
|
||||
}
|
||||
|
||||
int ApplicationSettings::getJavaMaximumMemory() const
|
||||
@@ -342,12 +342,12 @@ bool ApplicationSettings::setJreSystemLibraryPaths(const std::vector<FilePath>&
|
||||
|
||||
FilePath ApplicationSettings::getMavenPath() const
|
||||
{
|
||||
return FilePath(getValue<std::string>("indexing/java/maven_path", ""));
|
||||
return FilePath(getValue<std::wstring>("indexing/java/maven_path", L""));
|
||||
}
|
||||
|
||||
void ApplicationSettings::setMavenPath(const FilePath& path)
|
||||
{
|
||||
setValue<std::string>("indexing/java/maven_path", path.str());
|
||||
setValue<std::wstring>("indexing/java/maven_path", path.wstr());
|
||||
}
|
||||
|
||||
std::vector<FilePath> ApplicationSettings::getHeaderSearchPaths() const
|
||||
|
||||
@@ -89,7 +89,7 @@ public:
|
||||
bool getMultiProcessIndexingEnabled() const;
|
||||
void setMultiProcessIndexingEnabled(bool enabled);
|
||||
|
||||
std::string getJavaPath() const;
|
||||
FilePath getJavaPath() const;
|
||||
void setJavaPath(const FilePath& path);
|
||||
|
||||
int getJavaMaximumMemory() const;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include "utility/utilityUuid.h"
|
||||
|
||||
const size_t ProjectSettings::VERSION = 4;
|
||||
const char PROJECT_FILE_EXTENSION[] = ".srctrlprj";
|
||||
const wchar_t PROJECT_FILE_EXTENSION[] = L".srctrlprj";
|
||||
|
||||
LanguageType ProjectSettings::getLanguageOfProject(const FilePath& filePath)
|
||||
{
|
||||
@@ -48,11 +48,6 @@ ProjectSettings::ProjectSettings(const FilePath& projectFilePath)
|
||||
setFilePath(projectFilePath);
|
||||
}
|
||||
|
||||
ProjectSettings::ProjectSettings(std::string projectName, const FilePath& projectFileLocation)
|
||||
{
|
||||
setProjectFilePath(projectName, projectFileLocation);
|
||||
}
|
||||
|
||||
ProjectSettings::~ProjectSettings()
|
||||
{
|
||||
}
|
||||
@@ -114,14 +109,14 @@ FilePath ProjectSettings::getProjectFilePath() const
|
||||
return getFilePath();
|
||||
}
|
||||
|
||||
void ProjectSettings::setProjectFilePath(std::string projectName, const FilePath& projectFileLocation)
|
||||
void ProjectSettings::setProjectFilePath(std::wstring projectName, const FilePath& projectFileLocation)
|
||||
{
|
||||
setFilePath(FilePath(projectFileLocation.str() + "/" + projectName + PROJECT_FILE_EXTENSION));
|
||||
setFilePath(projectFileLocation.getConcatenated(L"/" + projectName + PROJECT_FILE_EXTENSION));
|
||||
}
|
||||
|
||||
std::string ProjectSettings::getProjectName() const
|
||||
std::wstring ProjectSettings::getProjectName() const
|
||||
{
|
||||
return getFilePath().withoutExtension().fileName();
|
||||
return getFilePath().withoutExtension().wFileName();
|
||||
}
|
||||
|
||||
FilePath ProjectSettings::getProjectDirectoryPath() const
|
||||
|
||||
@@ -19,7 +19,6 @@ public:
|
||||
|
||||
ProjectSettings();
|
||||
ProjectSettings(const FilePath& projectFilePath);
|
||||
ProjectSettings(std::string projectName, const FilePath& projectFileLocation);
|
||||
virtual ~ProjectSettings();
|
||||
|
||||
bool equalsExceptNameAndLocation(const ProjectSettings& other) const;
|
||||
@@ -30,9 +29,9 @@ public:
|
||||
bool reload();
|
||||
|
||||
FilePath getProjectFilePath() const;
|
||||
void setProjectFilePath(std::string projectName, const FilePath& projectFileLocation);
|
||||
void setProjectFilePath(std::wstring projectName, const FilePath& projectFileLocation);
|
||||
|
||||
std::string getProjectName() const;
|
||||
std::wstring getProjectName() const;
|
||||
FilePath getProjectDirectoryPath() const;
|
||||
|
||||
std::string getDescription() const;
|
||||
|
||||
@@ -114,11 +114,8 @@ void Settings::setFilePath(const FilePath& filePath)
|
||||
|
||||
std::vector<FilePath> Settings::getPathValues(const std::string& key) const
|
||||
{
|
||||
std::vector<std::string> values;
|
||||
values = getValues(key, values);
|
||||
|
||||
std::vector<FilePath> paths;
|
||||
for (const std::string& value : values)
|
||||
for (const std::wstring& value : getValues<std::wstring>(key, {}))
|
||||
{
|
||||
paths.push_back(FilePath(value));
|
||||
}
|
||||
@@ -127,10 +124,10 @@ std::vector<FilePath> Settings::getPathValues(const std::string& key) const
|
||||
|
||||
bool Settings::setPathValues(const std::string& key, const std::vector<FilePath>& paths)
|
||||
{
|
||||
std::vector<std::string> values;
|
||||
std::vector<std::wstring> values;
|
||||
for (const FilePath& path : paths)
|
||||
{
|
||||
values.push_back(path.str());
|
||||
values.push_back(path.wstr());
|
||||
}
|
||||
|
||||
return setValues(key, values);
|
||||
|
||||
@@ -174,11 +174,8 @@ void SourceGroupSettings::setSourceExtensions(const std::vector<std::string>& so
|
||||
|
||||
std::vector<FilePath> SourceGroupSettings::getPathValues(const std::string& key, std::shared_ptr<const ConfigManager> config)
|
||||
{
|
||||
std::vector<std::string> values;
|
||||
values = getValues(key, values, config);
|
||||
|
||||
std::vector<FilePath> paths;
|
||||
for (const std::string& value : values)
|
||||
for (const std::wstring& value : getValues<std::wstring>(key, {}, config))
|
||||
{
|
||||
paths.push_back(FilePath(value));
|
||||
}
|
||||
@@ -187,10 +184,10 @@ std::vector<FilePath> SourceGroupSettings::getPathValues(const std::string& key,
|
||||
|
||||
bool SourceGroupSettings::setPathValues(const std::string& key, const std::vector<FilePath>& paths, std::shared_ptr<ConfigManager> config)
|
||||
{
|
||||
std::vector<std::string> values;
|
||||
std::vector<std::wstring> values;
|
||||
for (const FilePath& path : paths)
|
||||
{
|
||||
values.push_back(path.str());
|
||||
values.push_back(path.wstr());
|
||||
}
|
||||
|
||||
return setValues(key, values, config);
|
||||
|
||||
@@ -19,7 +19,7 @@ void SourceGroupSettingsCxxCdb::load(std::shared_ptr<const ConfigManager> config
|
||||
|
||||
const std::string key = s_keyPrefix + getId();
|
||||
|
||||
setCompilationDatabasePath(FilePath(getValue<std::string>(key + "/build_file_path/compilation_db_path", "", config)));
|
||||
setCompilationDatabasePath(FilePath(getValue<std::wstring>(key + "/build_file_path/compilation_db_path", L"", config)));
|
||||
}
|
||||
|
||||
void SourceGroupSettingsCxxCdb::save(std::shared_ptr<ConfigManager> config)
|
||||
@@ -28,7 +28,7 @@ void SourceGroupSettingsCxxCdb::save(std::shared_ptr<ConfigManager> config)
|
||||
|
||||
const std::string key = s_keyPrefix + getId();
|
||||
|
||||
setValue(key + "/build_file_path/compilation_db_path", getCompilationDatabasePath().str(), config);
|
||||
setValue(key + "/build_file_path/compilation_db_path", getCompilationDatabasePath().wstr(), config);
|
||||
}
|
||||
|
||||
bool SourceGroupSettingsCxxCdb::equals(std::shared_ptr<SourceGroupSettings> other) const
|
||||
|
||||
@@ -18,8 +18,8 @@ void SourceGroupSettingsJavaGradle::load(std::shared_ptr<const ConfigManager> co
|
||||
|
||||
const std::string key = s_keyPrefix + getId();
|
||||
|
||||
setGradleProjectFilePath(FilePath(getValue<std::string>(key + "/gradle/project_file_path", "", config)));
|
||||
setGradleDependenciesDirectory(FilePath(getValue<std::string>(key + "/gradle/dependencies_directory", "", config)));
|
||||
setGradleProjectFilePath(FilePath(getValue<std::wstring>(key + "/gradle/project_file_path", L"", config)));
|
||||
setGradleDependenciesDirectory(FilePath(getValue<std::wstring>(key + "/gradle/dependencies_directory", L"", config)));
|
||||
setShouldIndexGradleTests(getValue<bool>(key + "/gradle/should_index_tests", false, config));
|
||||
}
|
||||
|
||||
@@ -29,8 +29,8 @@ void SourceGroupSettingsJavaGradle::save(std::shared_ptr<ConfigManager> config)
|
||||
|
||||
const std::string key = s_keyPrefix + getId();
|
||||
|
||||
setValue(key + "/gradle/project_file_path", getGradleProjectFilePath().str(), config);
|
||||
setValue(key + "/gradle/dependencies_directory", getGradleDependenciesDirectory().str(), config);
|
||||
setValue(key + "/gradle/project_file_path", getGradleProjectFilePath().wstr(), config);
|
||||
setValue(key + "/gradle/dependencies_directory", getGradleDependenciesDirectory().wstr(), config);
|
||||
setValue(key + "/gradle/should_index_tests", getShouldIndexGradleTests(), config);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@ void SourceGroupSettingsJavaMaven::load(std::shared_ptr<const ConfigManager> con
|
||||
|
||||
const std::string key = s_keyPrefix + getId();
|
||||
|
||||
setMavenProjectFilePath(FilePath(getValue<std::string>(key + "/maven/project_file_path", "", config)));
|
||||
setMavenDependenciesDirectory(FilePath(getValue<std::string>(key + "/maven/dependencies_directory", "", config)));
|
||||
setMavenProjectFilePath(FilePath(getValue<std::wstring>(key + "/maven/project_file_path", L"", config)));
|
||||
setMavenDependenciesDirectory(FilePath(getValue<std::wstring>(key + "/maven/dependencies_directory", L"", config)));
|
||||
setShouldIndexMavenTests(getValue<bool>(key + "/maven/should_index_tests", false, config));
|
||||
}
|
||||
|
||||
@@ -29,8 +29,8 @@ void SourceGroupSettingsJavaMaven::save(std::shared_ptr<ConfigManager> config)
|
||||
|
||||
const std::string key = s_keyPrefix + getId();
|
||||
|
||||
setValue(key + "/maven/project_file_path", getMavenProjectFilePath().str(), config);
|
||||
setValue(key + "/maven/dependencies_directory", getMavenDependenciesDirectory().str(), config);
|
||||
setValue(key + "/maven/project_file_path", getMavenProjectFilePath().wstr(), config);
|
||||
setValue(key + "/maven/dependencies_directory", getMavenDependenciesDirectory().wstr(), config);
|
||||
setValue(key + "/maven/should_index_tests", getShouldIndexMavenTests(), config);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user