src: specify if file or directory path is returned by helpers (#1146)

This commit is contained in:
Malte Langkabel
2021-02-22 21:55:30 +01:00
committed by GitHub
parent 6ab808852c
commit 4b922ed103
69 changed files with 259 additions and 253 deletions
+3 -3
View File
@@ -109,10 +109,10 @@ std::string Application::getUUID()
void Application::loadSettings()
{
MessageStatus(L"Load settings: " + UserPaths::getAppSettingsPath().wstr()).dispatch();
MessageStatus(L"Load settings: " + UserPaths::getAppSettingsFilePath().wstr()).dispatch();
std::shared_ptr<ApplicationSettings> settings = ApplicationSettings::getInstance();
settings->load(UserPaths::getAppSettingsPath());
settings->load(UserPaths::getAppSettingsFilePath());
LogManager::getInstance()->setLoggingEnabled(settings->getLoggingEnabled());
Logger* logger = LogManager::getInstance()->getLoggerByType("FileLogger");
@@ -464,7 +464,7 @@ void Application::updateRecentProjects(const FilePath& projectSettingsFilePath)
}
appSettings->setRecentProjects(recentProjects);
appSettings->save(UserPaths::getAppSettingsPath());
appSettings->save(UserPaths::getAppSettingsFilePath());
m_mainView->updateRecentProjectMenu();
}
+20 -18
View File
@@ -1,43 +1,45 @@
#include "AppPath.h"
FilePath AppPath::m_sharedDataPath(L"");
FilePath AppPath::m_cxxIndexerPath(L"");
#include "utilityApp.h"
FilePath AppPath::getSharedDataPath()
FilePath AppPath::s_sharedDataDirectoryPath(L"");
FilePath AppPath::s_cxxIndexerDirectoryPath(L"");
FilePath AppPath::getSharedDataDirectoryPath()
{
return m_sharedDataPath;
return s_sharedDataDirectoryPath;
}
bool AppPath::setSharedDataPath(const FilePath& path)
bool AppPath::setSharedDataDirectoryPath(const FilePath& path)
{
if (!path.empty())
{
m_sharedDataPath = path;
s_sharedDataDirectoryPath = path;
return true;
}
return false;
}
FilePath AppPath::getCxxIndexerPath()
FilePath AppPath::getCxxIndexerFilePath()
{
#if _WIN32
const std::wstring cxxIndexerName(L"sourcetrail_indexer.exe");
#else
const std::wstring cxxIndexerName(L"sourcetrail_indexer");
#endif
if (!m_cxxIndexerPath.empty())
std::wstring cxxIndexerName(L"sourcetrail_indexer");
if (utility::getOsType() == OS_WINDOWS)
{
return m_cxxIndexerPath.getConcatenated(cxxIndexerName);
cxxIndexerName = L"sourcetrail_indexer.exe";
}
return m_sharedDataPath.getConcatenated(cxxIndexerName);
if (!s_cxxIndexerDirectoryPath.empty())
{
return s_cxxIndexerDirectoryPath.getConcatenated(cxxIndexerName);
}
return s_sharedDataDirectoryPath.getConcatenated(cxxIndexerName);
}
bool AppPath::setCxxIndexerPath(const FilePath& path)
bool AppPath::setCxxIndexerDirectoryPath(const FilePath& path)
{
if (!path.empty())
{
m_cxxIndexerPath = path;
s_cxxIndexerDirectoryPath = path;
return true;
}
return false;
+6 -6
View File
@@ -6,15 +6,15 @@
class AppPath
{
public:
static FilePath getSharedDataPath();
static bool setSharedDataPath(const FilePath& path);
static FilePath getSharedDataDirectoryPath();
static bool setSharedDataDirectoryPath(const FilePath& path);
static FilePath getCxxIndexerPath();
static bool setCxxIndexerPath(const FilePath& path);
static FilePath getCxxIndexerFilePath();
static bool setCxxIndexerDirectoryPath(const FilePath& path);
private:
static FilePath m_sharedDataPath;
static FilePath m_cxxIndexerPath;
static FilePath s_sharedDataDirectoryPath;
static FilePath s_cxxIndexerDirectoryPath;
};
#endif // APP_PATH_H
+17 -17
View File
@@ -3,49 +3,49 @@
#include "AppPath.h"
#include "utilityApp.h"
FilePath ResourcePaths::getColorSchemesPath()
FilePath ResourcePaths::getColorSchemesDirectoryPath()
{
return AppPath::getSharedDataPath().concatenate(L"data/color_schemes/");
return AppPath::getSharedDataDirectoryPath().concatenate(L"data/color_schemes/");
}
FilePath ResourcePaths::getSyntaxHighlightingRulesPath()
FilePath ResourcePaths::getSyntaxHighlightingRulesDirectoryPath()
{
return AppPath::getSharedDataPath().concatenate(L"data/syntax_highlighting_rules/");
return AppPath::getSharedDataDirectoryPath().concatenate(L"data/syntax_highlighting_rules/");
}
FilePath ResourcePaths::getFallbackPath()
FilePath ResourcePaths::getFallbackDirectoryPath()
{
return AppPath::getSharedDataPath().concatenate(L"data/fallback/");
return AppPath::getSharedDataDirectoryPath().concatenate(L"data/fallback/");
}
FilePath ResourcePaths::getFontsPath()
FilePath ResourcePaths::getFontsDirectoryPath()
{
return AppPath::getSharedDataPath().concatenate(L"data/fonts/");
return AppPath::getSharedDataDirectoryPath().concatenate(L"data/fonts/");
}
FilePath ResourcePaths::getGuiPath()
FilePath ResourcePaths::getGuiDirectoryPath()
{
return AppPath::getSharedDataPath().concatenate(L"data/gui/");
return AppPath::getSharedDataDirectoryPath().concatenate(L"data/gui/");
}
FilePath ResourcePaths::getLicensePath()
FilePath ResourcePaths::getLicenseDirectoryPath()
{
return AppPath::getSharedDataPath().concatenate(L"data/license/");
return AppPath::getSharedDataDirectoryPath().concatenate(L"data/license/");
}
FilePath ResourcePaths::getJavaPath()
FilePath ResourcePaths::getJavaDirectoryPath()
{
return AppPath::getSharedDataPath().concatenate(L"data/java/");
return AppPath::getSharedDataDirectoryPath().concatenate(L"data/java/");
}
FilePath ResourcePaths::getPythonDirectoryPath()
{
return AppPath::getSharedDataPath().concatenate(L"data/python/");
return AppPath::getSharedDataDirectoryPath().concatenate(L"data/python/");
}
FilePath ResourcePaths::getCxxCompilerHeaderPath()
FilePath ResourcePaths::getCxxCompilerHeaderDirectoryPath()
{
return AppPath::getSharedDataPath().concatenate(L"data/cxx/include/").getCanonical();
return AppPath::getSharedDataDirectoryPath().concatenate(L"data/cxx/include/").getCanonical();
}
FilePath ResourcePaths::getPythonIndexerFilePath()
+8 -8
View File
@@ -8,15 +8,15 @@
class ResourcePaths
{
public:
static FilePath getColorSchemesPath();
static FilePath getSyntaxHighlightingRulesPath();
static FilePath getFallbackPath();
static FilePath getFontsPath();
static FilePath getGuiPath();
static FilePath getLicensePath();
static FilePath getJavaPath();
static FilePath getColorSchemesDirectoryPath();
static FilePath getSyntaxHighlightingRulesDirectoryPath();
static FilePath getFallbackDirectoryPath();
static FilePath getFontsDirectoryPath();
static FilePath getGuiDirectoryPath();
static FilePath getLicenseDirectoryPath();
static FilePath getJavaDirectoryPath();
static FilePath getPythonDirectoryPath();
static FilePath getCxxCompilerHeaderPath();
static FilePath getCxxCompilerHeaderDirectoryPath();
static FilePath getPythonIndexerFilePath();
};
+11 -11
View File
@@ -1,28 +1,28 @@
#include "UserPaths.h"
FilePath UserPaths::s_userDataPath;
FilePath UserPaths::s_userDataDirectoryPath;
FilePath UserPaths::getUserDataPath()
FilePath UserPaths::getUserDataDirectoryPath()
{
return s_userDataPath;
return s_userDataDirectoryPath;
}
void UserPaths::setUserDataPath(const FilePath& path)
void UserPaths::setUserDataDirectoryPath(const FilePath& path)
{
s_userDataPath = path;
s_userDataDirectoryPath = path;
}
FilePath UserPaths::getAppSettingsPath()
FilePath UserPaths::getAppSettingsFilePath()
{
return getUserDataPath().concatenate(L"ApplicationSettings.xml");
return getUserDataDirectoryPath().concatenate(L"ApplicationSettings.xml");
}
FilePath UserPaths::getWindowSettingsPath()
FilePath UserPaths::getWindowSettingsFilePath()
{
return getUserDataPath().concatenate(L"window_settings.ini");
return getUserDataDirectoryPath().concatenate(L"window_settings.ini");
}
FilePath UserPaths::getLogPath()
FilePath UserPaths::getLogDirectoryPath()
{
return getUserDataPath().concatenate(L"log/");
return getUserDataDirectoryPath().concatenate(L"log/");
}
+6 -6
View File
@@ -8,15 +8,15 @@
class UserPaths
{
public:
static FilePath getUserDataPath();
static void setUserDataPath(const FilePath& path);
static FilePath getUserDataDirectoryPath();
static void setUserDataDirectoryPath(const FilePath& path);
static FilePath getAppSettingsPath();
static FilePath getWindowSettingsPath();
static FilePath getLogPath();
static FilePath getAppSettingsFilePath();
static FilePath getWindowSettingsFilePath();
static FilePath getLogDirectoryPath();
private:
static FilePath s_userDataPath;
static FilePath s_userDataDirectoryPath;
};
#endif // USER_PATHS_H