src: implemented move constructor/assignment for filepath

* improves indexing performance by roughly 5%
* switched to use uniqu_ptr for boost path to get rid of including boost in header
* added different methods to change the current FilePath or to make a copy and change that one
* used these methods appropriately throughout the code base
* removed exists() method from FileSystem because it is already contained in FilePath
* added const in some places
This commit is contained in:
mlangkabel
2017-12-23 10:28:25 +01:00
parent 455c1230b1
commit 8b21d57750
73 changed files with 433 additions and 370 deletions
+2 -2
View File
@@ -152,7 +152,7 @@ std::set<FilePath> SourceGroupJava::fetchRootDirectories()
continue;
}
FilePath rootPath = filePath.parentDirectory();
FilePath rootPath = filePath.getParentDirectory();
bool success = true;
const std::vector<std::string> packageNameParts = utility::splitToVector(packageName, ".");
@@ -163,7 +163,7 @@ std::set<FilePath> SourceGroupJava::fetchRootDirectories()
success = false;
break;
}
rootPath = rootPath.parentDirectory();
rootPath = rootPath.getParentDirectory();
}
if (success)
@@ -73,7 +73,7 @@ std::vector<FilePath> SourceGroupJavaGradle::getAllSourcePaths() const
std::shared_ptr<DialogView> dialogView = Application::getInstance()->getDialogView();
dialogView->showUnknownProgressDialog("Preparing Project", "Gradle\nFetching Source Directories");
const FilePath projectRootPath = m_settings->getGradleProjectFilePathExpandedAndAbsolute().parentDirectory();
const FilePath projectRootPath = m_settings->getGradleProjectFilePathExpandedAndAbsolute().getParentDirectory();
sourcePaths = utility::gradleGetAllSourceDirectories(projectRootPath, m_settings->getShouldIndexGradleTests());
dialogView->hideUnknownProgressDialog();
@@ -85,7 +85,7 @@ bool SourceGroupJavaGradle::prepareGradleData()
{
if (m_settings && m_settings->getGradleProjectFilePathExpandedAndAbsolute().exists())
{
const FilePath projectRootPath = m_settings->getGradleProjectFilePathExpandedAndAbsolute().parentDirectory();
const FilePath projectRootPath = m_settings->getGradleProjectFilePathExpandedAndAbsolute().getParentDirectory();
std::shared_ptr<DialogView> dialogView = Application::getInstance()->getDialogView();
@@ -74,7 +74,7 @@ std::vector<FilePath> SourceGroupJavaMaven::getAllSourcePaths() const
dialogView->showUnknownProgressDialog("Preparing Project", "Maven\nFetching Source Directories");
const FilePath mavenPath(ApplicationSettings::getInstance()->getMavenPath());
const FilePath projectRootPath = m_settings->getMavenProjectFilePathExpandedAndAbsolute().parentDirectory();
const FilePath projectRootPath = m_settings->getMavenProjectFilePathExpandedAndAbsolute().getParentDirectory();
sourcePaths = utility::mavenGetAllDirectoriesFromEffectivePom(mavenPath, projectRootPath, m_settings->getShouldIndexMavenTests());
dialogView->hideUnknownProgressDialog();
@@ -87,7 +87,7 @@ bool SourceGroupJavaMaven::prepareMavenData()
if (m_settings && m_settings->getMavenProjectFilePathExpandedAndAbsolute().exists())
{
const FilePath mavenPath = ApplicationSettings::getInstance()->getMavenPath();
const FilePath projectRootPath = m_settings->getMavenProjectFilePathExpandedAndAbsolute().parentDirectory();
const FilePath projectRootPath = m_settings->getMavenProjectFilePathExpandedAndAbsolute().getParentDirectory();
std::shared_ptr<DialogView> dialogView = Application::getInstance()->getDialogView();
dialogView->showUnknownProgressDialog("Preparing Project", "Maven\nGenerating Source Files");
+1 -1
View File
@@ -19,7 +19,7 @@ namespace
if (getenv("JAVA_HOME") == nullptr)
{
const FilePath javaPath(ApplicationSettings::getInstance()->getJavaPath());
const FilePath javaHomePath = javaPath.parentDirectory().parentDirectory().parentDirectory();
const FilePath javaHomePath = javaPath.getParentDirectory().getParentDirectory().getParentDirectory();
LOG_WARNING("Environment variable \"JAVA_HOME\" not found on system. Setting value to \"" + javaHomePath.str() + "\" for this process.");
+2 -2
View File
@@ -39,7 +39,7 @@ namespace
FilePath path(fetchedDirectory);
if (!toAppend.empty())
{
path = path.concat(toAppend);
path.concatenate(toAppend);
}
pathList.push_back(path);
LOG_INFO("Found directory \"" + path.str() + "\".");
@@ -51,7 +51,7 @@ namespace
if (getenv("JAVA_HOME") == nullptr)
{
const FilePath javaPath(ApplicationSettings::getInstance()->getJavaPath());
const FilePath javaHomePath = javaPath.parentDirectory().parentDirectory().parentDirectory();
const FilePath javaHomePath = javaPath.getParentDirectory().getParentDirectory().getParentDirectory();
LOG_WARNING("Environment variable \"JAVA_HOME\" not found on system. Setting value to \"" + javaHomePath.str() + "\" for this process.");