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
@@ -40,28 +40,28 @@ void setupApp(int argc, char *argv[])
// This "copyFile" method does nothing if the copy destination already exist
#ifdef DEPLOY
#ifdef DEPLOY
// try to find files in Coati installation to migrate to Sourcetrail
FilePath coatiUserDataPath = UserPaths::getUserDataPath().concat(FilePath("../"));
FilePath coatiUserDataPath = UserPaths::getUserDataPath().concatenate(FilePath("../"));
if (utility::getApplicationArchitectureType() == APPLICATION_ARCHITECTURE_X86_64)
{
coatiUserDataPath = coatiUserDataPath.concat(FilePath("Coati 64-bit"));
coatiUserDataPath = coatiUserDataPath.concatenate(FilePath("Coati 64-bit"));
}
else
{
coatiUserDataPath = coatiUserDataPath.concat(FilePath("Coati"));
coatiUserDataPath = coatiUserDataPath.concatenate(FilePath("Coati"));
}
if (coatiUserDataPath.exists())
{
FileSystem::copyFile(coatiUserDataPath.concat(FilePath("ApplicationSettings.xml")), UserPaths::getAppSettingsPath());
FileSystem::copyFile(coatiUserDataPath.concat(FilePath("window_settings.ini")), UserPaths::getWindowSettingsPath());
FileSystem::copyFile(coatiUserDataPath.concatenate(FilePath("ApplicationSettings.xml")), UserPaths::getAppSettingsPath());
FileSystem::copyFile(coatiUserDataPath.concatenate(FilePath("window_settings.ini")), UserPaths::getWindowSettingsPath());
}
#endif
// use files in fallback folder if Coati has not been installed and used before
FileSystem::copyFile(ResourcePaths::getFallbackPath().concat(FilePath("ApplicationSettings.xml")), UserPaths::getAppSettingsPath());
FileSystem::copyFile(ResourcePaths::getFallbackPath().concat(FilePath("window_settings.ini")), UserPaths::getWindowSettingsPath());
FileSystem::copyFile(ResourcePaths::getFallbackPath().concatenate(FilePath("ApplicationSettings.xml")), UserPaths::getAppSettingsPath());
FileSystem::copyFile(ResourcePaths::getFallbackPath().concatenate(FilePath("window_settings.ini")), UserPaths::getWindowSettingsPath());
}
#endif // INCLUDES_WINDOWS_H