logic: reduce access to filesystem while indexing

* use canonical filepath cache in cxx indexer
* made constructors of FilePath explicit
* use FilePath at more places instead of string
* forward declares FilePath wherever possible
This commit is contained in:
malte_langkabel
2017-05-04 10:55:16 +02:00
parent 55d3f9c189
commit 054b8fab17
156 changed files with 656 additions and 444 deletions
+6 -6
View File
@@ -110,7 +110,7 @@ void ApplicationSettings::setUseAnimations(bool useAnimations)
FilePath ApplicationSettings::getColorSchemePath() const
{
FilePath defaultPath(ResourcePaths::getColorSchemesPath() + "bright.xml");
FilePath defaultPath(ResourcePaths::getColorSchemesPath().concat(FilePath("bright.xml")));
FilePath path(getValue<std::string>("application/color_scheme", defaultPath.str()));
if (path != defaultPath && !path.exists())
@@ -276,14 +276,14 @@ void ApplicationSettings::setJavaMaximumMemory(int size)
setValue<int>("indexing/java/java_maximum_memory", size);
}
std::string ApplicationSettings::getMavenPath() const
FilePath ApplicationSettings::getMavenPath() const
{
return getValue<std::string>("indexing/java/maven_path", "");
return FilePath(getValue<std::string>("indexing/java/maven_path", ""));
}
void ApplicationSettings::setMavenPath(const std::string path)
void ApplicationSettings::setMavenPath(const FilePath& path)
{
setValue<std::string>("indexing/java/maven_path", path);
setValue<std::string>("indexing/java/maven_path", path.str());
}
std::vector<FilePath> ApplicationSettings::getHeaderSearchPaths() const
@@ -369,7 +369,7 @@ std::vector<FilePath> ApplicationSettings::getRecentProjects() const
}
else
{
recentProjects.push_back(UserPaths::getSampleProjectsPath() + project.str());
recentProjects.push_back(UserPaths::getSampleProjectsPath().concat(project));
}
}
return recentProjects;
+2 -2
View File
@@ -82,8 +82,8 @@ public:
int getJavaMaximumMemory() const;
void setJavaMaximumMemory(int size);
std::string getMavenPath() const;
void setMavenPath(const std::string path);
FilePath getMavenPath() const;
void setMavenPath(const FilePath& path);
std::vector<FilePath> getHeaderSearchPaths() const;
std::vector<FilePath> getHeaderSearchPathsExpanded() const;
+1 -1
View File
@@ -31,7 +31,7 @@ bool Settings::load(const FilePath& filePath)
{
if (filePath.exists())
{
m_config = ConfigManager::createAndLoad(TextAccess::createFromFile(filePath.str()));
m_config = ConfigManager::createAndLoad(TextAccess::createFromFile(filePath));
m_filePath = filePath;
return true;
}