Add ability to customize cache folder
Add an advanced settings page, currently only housing the "Cache" category Fix #541
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
#include "singletons/Paths.hpp"
|
||||
|
||||
#include "singletons/Settings.hpp"
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QCryptographicHash>
|
||||
#include <QDir>
|
||||
@@ -33,6 +35,27 @@ bool Paths::isPortable()
|
||||
return this->portable_.get();
|
||||
}
|
||||
|
||||
QString Paths::cacheDirectory()
|
||||
{
|
||||
static QStringSetting cachePathSetting = [] {
|
||||
QStringSetting cachePathSetting("/cache/path");
|
||||
|
||||
cachePathSetting.connect([](const auto &newPath, auto) {
|
||||
QDir().mkpath(newPath); //
|
||||
});
|
||||
|
||||
return cachePathSetting;
|
||||
}();
|
||||
|
||||
auto path = cachePathSetting.getValue();
|
||||
|
||||
if (path == "") {
|
||||
return this->cacheDirectory_;
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
void Paths::initAppFilePathHash()
|
||||
{
|
||||
this->applicationFilePathHash =
|
||||
@@ -104,7 +127,7 @@ void Paths::initSubDirectories()
|
||||
|
||||
makePath("");
|
||||
this->settingsDirectory = makePath("Settings");
|
||||
this->cacheDirectory = makePath("Cache");
|
||||
this->cacheDirectory_ = makePath("Cache");
|
||||
this->messageLogDirectory = makePath("Logs");
|
||||
this->miscDirectory = makePath("Misc");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user