UI: Default User specific Logs path is "%LocalAppData%/Fort Firewall/logs"

This commit is contained in:
Nodir Temirkhodjaev 2022-05-12 10:40:40 +03:00
parent fa59377967
commit 76eb2a3eac
3 changed files with 27 additions and 27 deletions

View File

@ -29,10 +29,6 @@
;Default is "<profileDir>". ;Default is "<profileDir>".
;statDir=%FORTHOME%/Data ;statDir=%FORTHOME%/Data
;Directory to store logs.
;Default is "<profileDir>/logs".
;logsDir=%FORTHOME%/Data/logs
;Directory to store cache. ;Directory to store cache.
;Default is "<profileDir>/cache". ;Default is "<profileDir>/cache".
;cacheDir=%FORTHOME%/Data/cache ;cacheDir=%FORTHOME%/Data/cache
@ -40,3 +36,7 @@
;Directory to store user settings. ;Directory to store user settings.
;Default is "%LocalAppData%/Fort Firewall". ;Default is "%LocalAppData%/Fort Firewall".
;userDir=%FORTHOME%/Data ;userDir=%FORTHOME%/Data
;Directory to store logs.
;Default is "<userDir>/logs".
;logsDir=%FORTHOME%/Data/logs

View File

@ -113,9 +113,9 @@ void FortSettings::setupGlobal()
m_profilePath = settings.value("global/profileDir").toString(); m_profilePath = settings.value("global/profileDir").toString();
m_statPath = settings.value("global/statDir").toString(); m_statPath = settings.value("global/statDir").toString();
m_logsPath = settings.value("global/logsDir").toString();
m_cachePath = settings.value("global/cacheDir").toString(); m_cachePath = settings.value("global/cacheDir").toString();
m_userPath = settings.value("global/userDir").toString(); m_userPath = settings.value("global/userDir").toString();
m_logsPath = settings.value("global/logsDir").toString();
} }
void FortSettings::initialize(const QStringList &args, EnvManager *envManager) void FortSettings::initialize(const QStringList &args, EnvManager *envManager)
@ -140,12 +140,12 @@ void FortSettings::processArguments(const QStringList &args)
const QCommandLineOption statOption("stat", "Directory to store statistics.", "stat"); const QCommandLineOption statOption("stat", "Directory to store statistics.", "stat");
parser.addOption(statOption); parser.addOption(statOption);
const QCommandLineOption logsOption("logs", "Directory to store logs.", "logs");
parser.addOption(logsOption);
const QCommandLineOption cacheOption("cache", "Directory to store cache.", "cache"); const QCommandLineOption cacheOption("cache", "Directory to store cache.", "cache");
parser.addOption(cacheOption); parser.addOption(cacheOption);
const QCommandLineOption logsOption("logs", "Directory to store logs.", "logs");
parser.addOption(logsOption);
const QCommandLineOption uninstallOption("u", "Uninstall booted provider and startup entries."); const QCommandLineOption uninstallOption("u", "Uninstall booted provider and startup entries.");
parser.addOption(uninstallOption); parser.addOption(uninstallOption);
@ -196,16 +196,16 @@ void FortSettings::processArguments(const QStringList &args)
m_statPath = parser.value(statOption); m_statPath = parser.value(statOption);
} }
// Logs Path
if (parser.isSet(logsOption)) {
m_logsPath = parser.value(logsOption);
}
// Cache Path // Cache Path
if (parser.isSet(cacheOption)) { if (parser.isSet(cacheOption)) {
m_cachePath = parser.value(cacheOption); m_cachePath = parser.value(cacheOption);
} }
// Logs Path
if (parser.isSet(logsOption)) {
m_logsPath = parser.value(logsOption);
}
// Control command // Control command
m_controlCommand = parser.value(controlOption); m_controlCommand = parser.value(controlOption);
@ -232,13 +232,6 @@ void FortSettings::setupPaths(EnvManager *envManager)
m_statPath = expandPath(m_statPath, envManager); m_statPath = expandPath(m_statPath, envManager);
} }
// Logs Path
if (m_logsPath.isEmpty()) {
m_logsPath = m_profilePath + "logs/";
} else {
m_logsPath = expandPath(m_logsPath, envManager);
}
// Cache Path // Cache Path
if (m_cachePath.isEmpty()) { if (m_cachePath.isEmpty()) {
m_cachePath = m_profilePath + "cache/"; m_cachePath = m_profilePath + "cache/";
@ -248,10 +241,17 @@ void FortSettings::setupPaths(EnvManager *envManager)
// User Settings Path // User Settings Path
if (m_userPath.isEmpty()) { if (m_userPath.isEmpty()) {
m_userPath = defaultProfilePath(false); m_userPath = defaultProfilePath(isService());
} else { } else {
m_userPath = expandPath(m_userPath, envManager); m_userPath = expandPath(m_userPath, envManager);
} }
// Logs Path
if (m_logsPath.isEmpty()) {
m_logsPath = m_userPath + "logs/";
} else {
m_logsPath = expandPath(m_logsPath, envManager);
}
} }
void FortSettings::createPaths() void FortSettings::createPaths()
@ -281,7 +281,7 @@ bool FortSettings::isPortable()
return g_isPortable; return g_isPortable;
} }
QString FortSettings::defaultProfilePath(bool hasService) QString FortSettings::defaultProfilePath(bool isService)
{ {
// Is portable? // Is portable?
if (isPortable()) { if (isPortable()) {
@ -289,7 +289,7 @@ QString FortSettings::defaultProfilePath(bool hasService)
} }
// Is service? // Is service?
if (hasService) { if (isService) {
const QString servicePath = const QString servicePath =
FileUtil::expandPath(QLatin1String("%ProgramData%\\") + APP_NAME); FileUtil::expandPath(QLatin1String("%ProgramData%\\") + APP_NAME);
return pathSlash(servicePath); return pathSlash(servicePath);

View File

@ -36,13 +36,13 @@ public:
QString statPath() const { return m_statPath; } QString statPath() const { return m_statPath; }
QString statFilePath() const; QString statFilePath() const;
QString logsPath() const { return m_logsPath; }
QString cachePath() const { return m_cachePath; } QString cachePath() const { return m_cachePath; }
QString cacheFilePath() const; QString cacheFilePath() const;
QString userPath() const { return m_userPath; } QString userPath() const { return m_userPath; }
QString logsPath() const { return m_logsPath; }
QString controlCommand() const { return m_controlCommand; } QString controlCommand() const { return m_controlCommand; }
const QStringList &args() const { return m_args; } const QStringList &args() const { return m_args; }
@ -67,7 +67,7 @@ public:
bool canMigrate(QString &viaVersion) const; bool canMigrate(QString &viaVersion) const;
static bool isPortable(); static bool isPortable();
static QString defaultProfilePath(bool hasService); static QString defaultProfilePath(bool isService);
signals: signals:
void passwordCheckedChanged(); void passwordCheckedChanged();
@ -99,9 +99,9 @@ private:
QString m_defaultLanguage; QString m_defaultLanguage;
QString m_profilePath; QString m_profilePath;
QString m_statPath; QString m_statPath;
QString m_logsPath;
QString m_cachePath; QString m_cachePath;
QString m_userPath; QString m_userPath;
QString m_logsPath;
QString m_controlCommand; QString m_controlCommand;
QStringList m_args; QStringList m_args;