mirror of
https://github.com/wownero/wowlet.git
synced 2026-10-17 15:21:30 +02:00
Portable mode: accept 'portable.txt'
This commit is contained in:
+11
-3
@@ -102,10 +102,18 @@ bool dirExists(const QString &path) {
|
||||
return pathDir.exists();
|
||||
}
|
||||
|
||||
bool portableFileExists(const QString &dir) {
|
||||
QStringList portableFiles = {".portable", ".portable.txt", "portable.txt"};
|
||||
|
||||
return std::find_if(portableFiles.begin(), portableFiles.end(), [dir](const QString &portableFile){
|
||||
return QFile::exists(dir + "/" + portableFile);
|
||||
}) != portableFiles.end();
|
||||
}
|
||||
|
||||
QString defaultWalletDir() {
|
||||
QString portablePath = QCoreApplication::applicationDirPath().append("/%1");
|
||||
if (QFile::exists(portablePath.arg(".portable")) || QFile::exists(portablePath.arg(".portable.txt"))) {
|
||||
return portablePath.arg("feather_data/wallets");
|
||||
QString portablePath = QCoreApplication::applicationDirPath();
|
||||
if (Utils::portableFileExists(portablePath)) {
|
||||
return portablePath + "/feather_data/wallets";
|
||||
}
|
||||
|
||||
if (TailsOS::detect()) {
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace Utils
|
||||
QStringList fileFind(const QRegularExpression &pattern, const QString &baseDir, int level, int depth, int maxPerDir);
|
||||
|
||||
bool dirExists(const QString &path);
|
||||
bool portableFileExists(const QString &dir);
|
||||
QString defaultWalletDir();
|
||||
QString applicationPath();
|
||||
|
||||
|
||||
@@ -168,9 +168,9 @@ Config::Config(QObject* parent)
|
||||
}
|
||||
|
||||
QDir Config::defaultConfigDir() {
|
||||
QString portablePath = QCoreApplication::applicationDirPath().append("/%1");
|
||||
if (QFile::exists(portablePath.arg(".portable")) || QFile::exists(portablePath.arg(".portable.txt"))) {
|
||||
return portablePath.arg("feather_data");
|
||||
QString portablePath = QCoreApplication::applicationDirPath();
|
||||
if (Utils::portableFileExists(portablePath)) {
|
||||
return portablePath + "/feather_data";
|
||||
}
|
||||
|
||||
if (TailsOS::detect()) {
|
||||
|
||||
Reference in New Issue
Block a user