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
@@ -467,7 +467,7 @@ void QtProjectWizzard::sourcePathsJava()
void QtProjectWizzard::sourcePathsJavaMaven()
{
std::dynamic_pointer_cast<SourceGroupSettingsJava>(m_sourceGroupSettings)->setMavenDependenciesDirectory(
"./sourcetrail_dependencies/" + utility::replace(m_projectSettings->getProjectName(), " ", "_") + "/maven"
FilePath("./sourcetrail_dependencies/" + utility::replace(m_projectSettings->getProjectName(), " ", "_") + "/maven")
);
QtProjectWizzardWindow* window = createWindowWithSummary(
@@ -85,7 +85,7 @@ void QtProjectWizzardContentData::save()
if (m_projectName)
{
m_projectSettings->setProjectName(m_projectName->text().toStdString());
m_projectSettings->setProjectFileLocation(m_projectFileLocation->getText().toStdString());
m_projectSettings->setProjectFileLocation(FilePath(m_projectFileLocation->getText().toStdString()));
}
if (m_standard)
@@ -239,7 +239,7 @@ void QtProjectWizzardContentDataCDB::save()
{
QtProjectWizzardContentData::save();
FilePath path = m_buildFilePicker->getText().toStdString();
FilePath path(m_buildFilePicker->getText().toStdString());
FilePath absPath = m_projectSettings->makePathAbsolute(m_projectSettings->expandPath(path)); // maybe we can use SourceGroupSettings for this... that's where the the cdb path is stored.
if (!absPath.exists() || absPath.extension() != ".json")
{
@@ -260,7 +260,7 @@ bool QtProjectWizzardContentDataCDB::check()
return false;
}
FilePath path = m_buildFilePicker->getText().toStdString();
FilePath path(m_buildFilePicker->getText().toStdString());
FilePath absPath = m_projectSettings->makePathAbsolute(m_projectSettings->expandPath(path));
if (!absPath.exists() || absPath.extension() != ".json")
{
@@ -115,7 +115,7 @@ void QtProjectWizzardContentPathSourceMaven::save()
std::shared_ptr<SourceGroupSettingsJava> javaSettings = std::dynamic_pointer_cast<SourceGroupSettingsJava>(m_settings);
if (javaSettings)
{
javaSettings->setMavenProjectFilePath(m_picker->getText().toStdString());
javaSettings->setMavenProjectFilePath(FilePath(m_picker->getText().toStdString()));
javaSettings->setShouldIndexMavenTests(m_shouldIndexTests->isChecked());
}
}
@@ -202,6 +202,6 @@ void QtProjectWizzardContentPathDependenciesMaven::save()
std::shared_ptr<SourceGroupSettingsJava> javaSettings = std::dynamic_pointer_cast<SourceGroupSettingsJava>(m_settings);
if (javaSettings)
{
javaSettings->setMavenDependenciesDirectory(m_picker->getText().toStdString());
javaSettings->setMavenDependenciesDirectory(FilePath(m_picker->getText().toStdString()));
}
}
@@ -271,7 +271,7 @@ void QtProjectWizzardContentPreferences::load()
if (m_mavenPath)
{
m_mavenPath->setText(QString::fromStdString(appSettings->getMavenPath()));
m_mavenPath->setText(QString::fromStdString(appSettings->getMavenPath().str()));
}
}
@@ -316,7 +316,7 @@ void QtProjectWizzardContentPreferences::save()
if (m_mavenPath)
{
appSettings->setMavenPath(m_mavenPath->getText().toStdString());
appSettings->setMavenPath(FilePath(m_mavenPath->getText().toStdString()));
}
}
@@ -111,7 +111,7 @@ void QtProjectWizzardContentSelect::populate(QGridLayout* layout, int& row)
{
QToolButton* b = createProjectButton(
utility::insertLineBreaksAtBlankSpaces(sourceGroupTypeToProjectSetupString(projectIt.type), 15).c_str(),
(ResourcePaths::getGuiPath() + "icon/" + m_projectTypeIconName[projectIt.type] + ".png").c_str()
(ResourcePaths::getGuiPath().str() + "icon/" + m_projectTypeIconName[projectIt.type] + ".png").c_str()
);
b->setProperty("source_group_type", int(projectIt.type));
projectButtons->addButton(b);