mirror of
https://github.com/feather-wallet/feather.git
synced 2024-11-16 17:27:38 +00:00
Portable mode: accept 'portable.txt'
This commit is contained in:
parent
52705375be
commit
4fcf746c3a
3 changed files with 15 additions and 6 deletions
|
@ -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()) {
|
||||
|
|
Loading…
Reference in a new issue