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
@@ -58,8 +58,8 @@ void QtListItemWidget::setText(QString text)
FilePath relativeRoot = m_list->getRelativeRootDirectory();
if (!relativeRoot.empty())
{
FilePath path(text.toStdString());
FilePath relPath(path.relativeTo(relativeRoot));
const FilePath path(text.toStdString());
const FilePath relPath = path.getRelativeTo(relativeRoot);
if (relPath.str().size() < path.str().size())
{
text = QString::fromStdString(relPath.str());
@@ -77,10 +77,10 @@ void QtListItemWidget::setFocus()
void QtListItemWidget::handleButtonPress()
{
FilePath path(m_data->text().toStdString());
FilePath relativeRoot = m_list->getRelativeRootDirectory();
const FilePath relativeRoot = m_list->getRelativeRootDirectory();
if (!path.empty() && !path.isAbsolute() && !relativeRoot.empty())
{
path = relativeRoot.concat(path);
path = relativeRoot.getConcatenated(path);
}
QStringList list = QtFileDialog::getFileNamesAndDirectories(this, QString::fromStdString(path.str()));
@@ -118,7 +118,7 @@ QtDirectoryListBox::QtDirectoryListBox(QWidget *parent, const QString& listName,
m_list->setAttribute(Qt::WA_MacShowFocusRect, 0);
m_list->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath().concat(FilePath("window/listbox.css"))).c_str());
setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("window/listbox.css"))).c_str());
layout->addWidget(m_list);
QWidget* buttonContainer = new QWidget(this);
+1 -1
View File
@@ -127,7 +127,7 @@ QtHistoryList::QtHistoryList(const std::vector<SearchMatch>& history, size_t cur
m_list->setItemWidget(item, line);
}
setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath().concat(FilePath("history_list/history_list.css"))).c_str());
setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("history_list/history_list.css"))).c_str());
connect(m_list, &QListWidget::itemClicked, this, &QtHistoryList::onItemClicked);
}
+3 -3
View File
@@ -102,7 +102,7 @@ void QtLocationPicker::handleButtonPress()
FilePath path(m_data->text().toStdString());
if (!path.empty() && !path.isAbsolute() && !m_relativeRootDirectory.empty())
{
path = m_relativeRootDirectory.concat(path);
path = m_relativeRootDirectory.getConcatenated(path);
}
QString fileName;
@@ -119,8 +119,8 @@ void QtLocationPicker::handleButtonPress()
{
if (!m_relativeRootDirectory.empty())
{
FilePath path(fileName.toStdString());
FilePath relPath(path.relativeTo(m_relativeRootDirectory));
const FilePath path(fileName.toStdString());
const FilePath relPath = path.getRelativeTo(m_relativeRootDirectory);
if (relPath.str().size() < path.str().size())
{
fileName = QString::fromStdString(relPath.str());
+1 -1
View File
@@ -119,7 +119,7 @@ void QtContextMenu::copyFullPathActionTriggered()
void QtContextMenu::openContainingFolderActionTriggered()
{
FilePath dir = s_filePath.parentDirectory();
FilePath dir = s_filePath.getParentDirectory();
if (dir.exists())
{
QDesktopServices::openUrl(QUrl(("file:///" + dir.str()).c_str(), QUrl::TolerantMode));
+2 -1
View File
@@ -250,7 +250,8 @@ void QtBookmarkView::showBookmarksClicked()
void QtBookmarkView::setStyleSheet()
{
m_widget->setStyleSheet(utility::getStyleSheet(
ResourcePaths::getGuiPath().concat(FilePath("bookmark_view/bookmark_view.css"))).c_str());
ResourcePaths::getGuiPath().concatenate(FilePath("bookmark_view/bookmark_view.css"))
).c_str());
}
void QtBookmarkView::refreshStyle()
+1 -1
View File
@@ -285,7 +285,7 @@ void QtCodeView::setStyleSheet() const
{
utility::setWidgetBackgroundColor(m_widget, ColorScheme::getInstance()->getColor("code/background"));
std::string styleSheet = utility::getStyleSheet(ResourcePaths::getGuiPath().concat(FilePath("code_view/code_view.css")));
std::string styleSheet = utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("code_view/code_view.css")));
m_widget->setStyleSheet(styleSheet.c_str());
}
+1 -1
View File
@@ -162,7 +162,7 @@ void QtGraphView::refreshView()
QtGraphicsView* view = getView();
std::string css = utility::getStyleSheet(ResourcePaths::getGuiPath().concat(FilePath("graph_view/graph_view.css")));
std::string css = utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("graph_view/graph_view.css")));
view->setStyleSheet(css.c_str());
view->setAppZoomFactor(GraphViewStyle::getZoomFactor());
view->refreshStyle();
+1 -1
View File
@@ -37,5 +37,5 @@ void QtRefreshView::refreshView()
void QtRefreshView::setStyleSheet()
{
m_widget->setStyleSheet(utility::getStyleSheet(
ResourcePaths::getGuiPath().concat(FilePath("refresh_view/refresh_view.css"))).c_str());
ResourcePaths::getGuiPath().concatenate(FilePath("refresh_view/refresh_view.css"))).c_str());
}
+1 -1
View File
@@ -45,7 +45,7 @@ void QtScreenSearchView::refreshView()
m_onQtThread([=]()
{
m_bar->setStyleSheet(
utility::getStyleSheet(ResourcePaths::getGuiPath().concat(
utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(
FilePath("screen_search_view/screen_search_view.css"))).c_str()
);
+1 -1
View File
@@ -78,7 +78,7 @@ void QtSearchView::setAutocompletionList(const std::vector<SearchMatch>& autocom
void QtSearchView::setStyleSheet()
{
std::string css = utility::getStyleSheet(ResourcePaths::getGuiPath().concat(FilePath("search_view/search_view.css")));
std::string css = utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("search_view/search_view.css")));
m_widget->setStyleSheet(css.c_str());
+1 -1
View File
@@ -65,6 +65,6 @@ void QtTabbedView::setStyleSheet()
QtViewWidgetWrapper::getWidgetOfView(this), ColorScheme::getInstance()->getColor("tab/background"));
m_widget->setStyleSheet(
utility::getStyleSheet(ResourcePaths::getGuiPath().concat(FilePath("tabbed_view/tabbed_view.css"))).c_str()
utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("tabbed_view/tabbed_view.css"))).c_str()
);
}
+1 -1
View File
@@ -31,7 +31,7 @@ void QtTooltipView::refreshView()
m_onQtThread([=]()
{
m_widget->setStyleSheet(
utility::getStyleSheet(ResourcePaths::getGuiPath().concat(FilePath("tooltip_view/tooltip_view.css"))).c_str()
utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("tooltip_view/tooltip_view.css"))).c_str()
);
});
}
+1 -1
View File
@@ -69,5 +69,5 @@ void QtUndoRedoView::updateHistory(const std::vector<SearchMatch>& searchMatches
void QtUndoRedoView::setStyleSheet()
{
m_widget->setStyleSheet(utility::getStyleSheet(
ResourcePaths::getGuiPath().concat(FilePath("undoredo_view/undoredo_view.css"))).c_str());
ResourcePaths::getGuiPath().concatenate(FilePath("undoredo_view/undoredo_view.css"))).c_str());
}
+1 -1
View File
@@ -23,7 +23,7 @@ QSize QtAbout::sizeHint() const
void QtAbout::setupAbout()
{
setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath().concat(FilePath("about/about.css"))).c_str());
setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("about/about.css"))).c_str());
QVBoxLayout* windowLayout = new QVBoxLayout();
windowLayout->setContentsMargins(10, 10, 10, 0);
+2 -2
View File
@@ -24,8 +24,8 @@ QtBookmarkBrowser::~QtBookmarkBrowser()
void QtBookmarkBrowser::setupBookmarkBrowser()
{
setStyleSheet((
utility::getStyleSheet(ResourcePaths::getGuiPath().concat(FilePath("window/window.css"))) +
utility::getStyleSheet(ResourcePaths::getGuiPath().concat(FilePath("bookmark_view/bookmark_view.css")))
utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("window/window.css"))) +
utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("bookmark_view/bookmark_view.css")))
).c_str());
m_headerBackground = new QWidget(m_window);
+2 -2
View File
@@ -106,8 +106,8 @@ void QtBookmarkCreator::setupBookmarkCreator()
void QtBookmarkCreator::refreshStyle()
{
setStyleSheet((
utility::getStyleSheet(ResourcePaths::getGuiPath().concat(FilePath("window/window.css"))) +
utility::getStyleSheet(ResourcePaths::getGuiPath().concat(FilePath("bookmark_view/bookmark_view.css")))
utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("window/window.css"))) +
utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("bookmark_view/bookmark_view.css")))
).c_str());
}
+2 -2
View File
@@ -378,8 +378,8 @@ QBoxLayout* QtIndexingDialog::createLayout()
);
setStyleSheet((
utility::getStyleSheet(ResourcePaths::getGuiPath().concat(FilePath("window/window.css"))) +
utility::getStyleSheet(ResourcePaths::getGuiPath().concat(FilePath("indexing_dialog/indexing_dialog.css")))
utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("window/window.css"))) +
utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("indexing_dialog/indexing_dialog.css")))
).c_str());
QVBoxLayout* layout = new QVBoxLayout(this);
@@ -70,7 +70,7 @@ void QtKeyboardShortcuts::populateWindow(QWidget* widget)
widget->setLayout(layout);
widget->setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath().concat(FilePath("keyboard_shortcuts/keyboard_shortcuts.css"))).c_str());
widget->setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("keyboard_shortcuts/keyboard_shortcuts.css"))).c_str());
}
void QtKeyboardShortcuts::windowReady()
+1 -1
View File
@@ -134,7 +134,7 @@ void QtLicenseWindow::populateWindow(QWidget* widget)
void QtLicenseWindow::windowReady()
{
m_content->setStyleSheet(m_content->styleSheet() +
utility::getStyleSheet(ResourcePaths::getGuiPath().concat(FilePath("license/license.css"))).c_str());
utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("license/license.css"))).c_str());
addLogo();
+7 -5
View File
@@ -128,7 +128,7 @@ QtMainWindow::QtMainWindow()
{
// can only be done once, because resetting the style on the QCoreApplication causes crash
app->setStyleSheet(
utility::getStyleSheet(ResourcePaths::getGuiPath().concat(FilePath("scrollbar.css"))).c_str());
utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("scrollbar.css"))).c_str());
}
m_recentProjectAction = new QAction*[ApplicationSettings::getInstance()->getMaxRecentProjectsCount()];
@@ -379,7 +379,7 @@ void QtMainWindow::setContentEnabled(bool enabled)
void QtMainWindow::refreshStyle()
{
setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath().concat(FilePath("main.css"))).c_str());
setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("main.css"))).c_str());
}
void QtMainWindow::keyPressEvent(QKeyEvent* event)
@@ -524,12 +524,12 @@ void QtMainWindow::enteredLicense()
void QtMainWindow::showDataFolder()
{
QDesktopServices::openUrl(QUrl(("file:///" + UserPaths::getUserDataPath().canonical().str()).c_str(), QUrl::TolerantMode));
QDesktopServices::openUrl(QUrl(("file:///" + UserPaths::getUserDataPath().makeCanonical().str()).c_str(), QUrl::TolerantMode));
}
void QtMainWindow::showLogFolder()
{
QDesktopServices::openUrl(QUrl(("file:///" + UserPaths::getLogPath().canonical().str()).c_str(), QUrl::TolerantMode));
QDesktopServices::openUrl(QUrl(("file:///" + UserPaths::getLogPath().makeCanonical().str()).c_str(), QUrl::TolerantMode));
}
void QtMainWindow::showStartScreen()
@@ -685,7 +685,9 @@ void QtMainWindow::resetWindowLayout()
{
FileSystem::remove(UserPaths::getWindowSettingsPath());
FileSystem::copyFile(
ResourcePaths::getFallbackPath().concat(FilePath("window_settings.ini")), UserPaths::getWindowSettingsPath());
ResourcePaths::getFallbackPath().concatenate(FilePath("window_settings.ini")),
UserPaths::getWindowSettingsPath()
);
loadDockWidgetLayout();
}
+2 -2
View File
@@ -138,7 +138,7 @@ size_t i = 0;
}
i++;
}
setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath().concat(FilePath("startscreen/startscreen.css"))).c_str());
setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("startscreen/startscreen.css"))).c_str());
}
void QtStartScreen::setupStartScreen()
@@ -146,7 +146,7 @@ void QtStartScreen::setupStartScreen()
License license;
license.loadFromEncodedString(ApplicationSettings::getInstance()->getLicenseString(), AppPath::getAppPath());
setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath().concat(FilePath("startscreen/startscreen.css"))).c_str());
setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("startscreen/startscreen.css"))).c_str());
addLogo();
QHBoxLayout* layout = new QHBoxLayout();
+1 -1
View File
@@ -88,7 +88,7 @@ QSize QtWindow::sizeHint() const
void QtWindow::setup()
{
setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath().concat(FilePath("window/window.css"))).c_str());
setStyleSheet(utility::getStyleSheet(ResourcePaths::getGuiPath().concatenate(FilePath("window/window.css"))).c_str());
QVBoxLayout* layout = new QVBoxLayout();
layout->setContentsMargins(10, 10, 10, 10);
@@ -74,7 +74,7 @@ void QtProjectWizzard::newProjectFromCDB(const FilePath& filePath, const std::ve
if (m_projectSettings->getProjectFilePath().empty())
{
m_projectSettings->setProjectFilePath(filePath.withoutExtension().fileName(), filePath.parentDirectory());
m_projectSettings->setProjectFilePath(filePath.withoutExtension().fileName(), filePath.getParentDirectory());
}
if (!m_contentWidget)
@@ -61,7 +61,7 @@ void QtProjectWizzardContentCDBSource::load()
if (projectPath.exists())
{
path = path.relativeTo(projectPath);
path.makeRelativeTo(projectPath);
}
m_fileNames.push_back(path.str());
@@ -226,7 +226,7 @@ std::vector<std::string> QtProjectWizzardContentPathSourceMaven::getFileNames()
std::shared_ptr<SourceGroupSettingsJavaMaven> settings = std::dynamic_pointer_cast<SourceGroupSettingsJavaMaven>(m_settings);
const FilePath mavenPath = ApplicationSettings::getInstance()->getMavenPath();
const FilePath mavenProjectRoot = settings->getMavenProjectFilePathExpandedAndAbsolute().parentDirectory();
const FilePath mavenProjectRoot = settings->getMavenProjectFilePathExpandedAndAbsolute().getParentDirectory();
std::vector<std::string> list;
std::shared_ptr<DialogView> dialogView = Application::getInstance()->getDialogView();
@@ -270,7 +270,7 @@ std::vector<std::string> QtProjectWizzardContentPathSourceMaven::getFileNames()
{
if (projectPath.exists())
{
path = path.relativeTo(projectPath);
path.makeRelativeTo(projectPath);
}
list.push_back(path.str());
@@ -370,7 +370,7 @@ std::vector<std::string> QtProjectWizzardContentPathSourceGradle::getFileNames()
{
std::shared_ptr<SourceGroupSettingsJavaGradle> settings = std::dynamic_pointer_cast<SourceGroupSettingsJavaGradle>(m_settings);
const FilePath gradleProjectRoot = settings->getGradleProjectFilePathExpandedAndAbsolute().parentDirectory();
const FilePath gradleProjectRoot = settings->getGradleProjectFilePathExpandedAndAbsolute().getParentDirectory();
std::vector<std::string> list;
@@ -401,7 +401,7 @@ std::vector<std::string> QtProjectWizzardContentPathSourceGradle::getFileNames()
{
if (projectPath.exists())
{
path = path.relativeTo(projectPath);
path.makeRelativeTo(projectPath);
}
list.push_back(path.str());
@@ -305,7 +305,7 @@ void QtProjectWizzardContentPathsCDBHeader::load()
{
for (const FilePath& path : IndexerCommandCxxCdb::getSourceFilesFromCDB(cdbPath))
{
sourcePaths.insert(path.parentDirectory());
sourcePaths.insert(path.getParentDirectory());
}
}
@@ -325,7 +325,7 @@ void QtProjectWizzardContentPathsCDBHeader::load()
if (lastPath.empty() || !lastPath.contains(path)) // don't add subdirectories of already added paths
{
lastPath = path;
rootPaths.push_back(path.relativeTo(projectPath));
rootPaths.push_back(path.getRelativeTo(projectPath));
}
}
@@ -22,7 +22,7 @@ std::vector<FilePath> CxxFrameworkPathDetector::getPaths() const
{
if (utility::isPostfix(" (framework directory)", path))
{
frameworkPaths.push_back(FilePath(utility::replace(path, " (framework directory)", "")).canonical());
frameworkPaths.push_back(FilePath(utility::replace(path, " (framework directory)", "")).makeCanonical());
}
}
return frameworkPaths;
@@ -22,7 +22,7 @@ std::vector<FilePath> CxxHeaderPathDetector::getPaths() const
{
if (!utility::isPostfix(" (framework directory)", path))
{
headerPaths.push_back(FilePath(path).canonical());
headerPaths.push_back(FilePath(path).makeCanonical());
}
}
return headerPaths;
@@ -23,7 +23,7 @@ CxxVs10To14HeaderPathDetector::~CxxVs10To14HeaderPathDetector()
std::vector<FilePath> CxxVs10To14HeaderPathDetector::getPaths() const
{
FilePath vsInstallPath = getVsInstallPathUsingRegistry();
const FilePath vsInstallPath = getVsInstallPathUsingRegistry();
// vc++ headers
std::vector<FilePath> headerSearchPaths;
@@ -35,10 +35,10 @@ std::vector<FilePath> CxxVs10To14HeaderPathDetector::getPaths() const
for (size_t i = 0; i < subdirectories.size(); i++)
{
FilePath headerSearchPath = vsInstallPath.concat(FilePath(subdirectories[i]));
FilePath headerSearchPath = vsInstallPath.getConcatenated(FilePath(subdirectories[i]));
if (headerSearchPath.exists())
{
headerSearchPaths.push_back(headerSearchPath.canonical());
headerSearchPaths.push_back(headerSearchPath.makeCanonical());
}
}
}
@@ -32,16 +32,16 @@ std::vector<FilePath> CxxVs15HeaderPathDetector::getPaths() const
const FilePath vsInstallPath(output);
if (vsInstallPath.exists())
{
for (const FilePath& versionPath : FileSystem::getDirectSubDirectories(vsInstallPath.concat(FilePath("VC/Tools/MSVC"))))
for (const FilePath& versionPath : FileSystem::getDirectSubDirectories(vsInstallPath.getConcatenated(FilePath("VC/Tools/MSVC"))))
{
if (versionPath.exists())
{
headerSearchPaths.push_back(versionPath.concat(FilePath("include")));
headerSearchPaths.push_back(versionPath.concat(FilePath("atlmfc/include")));
headerSearchPaths.push_back(versionPath.getConcatenated(FilePath("include")));
headerSearchPaths.push_back(versionPath.getConcatenated(FilePath("atlmfc/include")));
}
}
headerSearchPaths.push_back(vsInstallPath.concat(FilePath("VC/Auxiliary/VS/include")));
headerSearchPaths.push_back(vsInstallPath.concat(FilePath("VC/Auxiliary/VS/UnitTest/include")));
headerSearchPaths.push_back(vsInstallPath.getConcatenated(FilePath("VC/Auxiliary/VS/include")));
headerSearchPaths.push_back(vsInstallPath.getConcatenated(FilePath("VC/Auxiliary/VS/UnitTest/include")));
}
}
}
@@ -41,10 +41,10 @@ namespace utility
for (size_t i = 0; i < windowsSdkVersions.size(); i++)
{
FilePath sdkPath = getWindowsSdkRootPathUsingRegistry(architectureType, windowsSdkVersions[i]);
const FilePath sdkPath = getWindowsSdkRootPathUsingRegistry(architectureType, windowsSdkVersions[i]);
if (sdkPath.exists())
{
FilePath sdkIncludePath = sdkPath.concat(FilePath("include/"));
const FilePath sdkIncludePath = sdkPath.getConcatenated(FilePath("include/"));
if (sdkIncludePath.exists())
{
std::vector<std::string> subdirectories;
@@ -55,7 +55,7 @@ namespace utility
bool usingSubdirectories = false;
for (size_t j = 0; j < subdirectories.size(); j++)
{
FilePath sdkSubdirectory = sdkIncludePath.concat(FilePath(subdirectories[j]));
const FilePath sdkSubdirectory = sdkIncludePath.getConcatenated(FilePath(subdirectories[j]));
if (sdkSubdirectory.exists())
{
headerSearchPaths.push_back(sdkSubdirectory);
@@ -72,12 +72,12 @@ namespace utility
}
}
{
FilePath sdkPath = getWindowsSdkRootPathUsingRegistry(architectureType, "v10.0");
const FilePath sdkPath = getWindowsSdkRootPathUsingRegistry(architectureType, "v10.0");
if (sdkPath.exists())
{
for (const FilePath& versionPath : FileSystem::getDirectSubDirectories(sdkPath.concat(FilePath("include/"))))
for (const FilePath& versionPath : FileSystem::getDirectSubDirectories(sdkPath.getConcatenated(FilePath("include/"))))
{
const FilePath ucrtPath = versionPath.concat(FilePath("ucrt"));
const FilePath ucrtPath = versionPath.getConcatenated(FilePath("ucrt"));
if (ucrtPath.exists())
{
headerSearchPaths.push_back(ucrtPath);
@@ -52,15 +52,12 @@ FilePath JavaPathDetectorLinux::readLink(const FilePath& path) const
FilePath JavaPathDetectorLinux::getFilePathRelativeToJavaExecutable(FilePath& javaExecutablePath) const
{
FilePath p(javaExecutablePath.parentDirectory().str() + jvmLibPathRelativeToJavaExecutable);
if ( p.exists() )
FilePath p(javaExecutablePath.getParentDirectory().str() + jvmLibPathRelativeToJavaExecutable);
if (p.exists())
{
return p.canonical();
}
else
{
return FilePath();
return p.makeCanonical();
}
return FilePath();
}
FilePath JavaPathDetectorLinux::getJavaInJavaHome() const
@@ -21,8 +21,8 @@ std::vector<FilePath> JreSystemLibraryPathDetector::getPaths() const
std::vector<FilePath> paths;
for (const FilePath& jrePath: m_javaPathDetector->getPaths())
{
const FilePath javaRoot = jrePath.parentDirectory().parentDirectory().parentDirectory();
for (const FilePath& jarPath : FileSystem::getFilePathsFromDirectory(javaRoot.concat(FilePath("lib")), {".jar"}))
const FilePath javaRoot = jrePath.getParentDirectory().getParentDirectory().getParentDirectory();
for (const FilePath& jarPath : FileSystem::getFilePathsFromDirectory(javaRoot.getConcatenated(FilePath("lib")), {".jar"}))
{
paths.push_back(jarPath);
}
+1 -1
View File
@@ -167,7 +167,7 @@ bool utility::saveLicense(const License* license)
std::string appLocation = AppPath::getAppPath();
appSettings->setLicenseString(license->getLicenseEncodedString(appLocation));
appSettings->setLicenseCheck(license->hashLocation(FilePath(appLocation).absolute().str()));
appSettings->setLicenseCheck(license->hashLocation(FilePath(appLocation).makeAbsolute().str()));
appSettings->save();
return true;
}