mirror of
https://github.com/feather-wallet/feather.git
synced 2025-01-09 04:19:57 +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();
|
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 defaultWalletDir() {
|
||||||
QString portablePath = QCoreApplication::applicationDirPath().append("/%1");
|
QString portablePath = QCoreApplication::applicationDirPath();
|
||||||
if (QFile::exists(portablePath.arg(".portable")) || QFile::exists(portablePath.arg(".portable.txt"))) {
|
if (Utils::portableFileExists(portablePath)) {
|
||||||
return portablePath.arg("feather_data/wallets");
|
return portablePath + "/feather_data/wallets";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TailsOS::detect()) {
|
if (TailsOS::detect()) {
|
||||||
|
|
|
@ -22,6 +22,7 @@ namespace Utils
|
||||||
QStringList fileFind(const QRegularExpression &pattern, const QString &baseDir, int level, int depth, int maxPerDir);
|
QStringList fileFind(const QRegularExpression &pattern, const QString &baseDir, int level, int depth, int maxPerDir);
|
||||||
|
|
||||||
bool dirExists(const QString &path);
|
bool dirExists(const QString &path);
|
||||||
|
bool portableFileExists(const QString &dir);
|
||||||
QString defaultWalletDir();
|
QString defaultWalletDir();
|
||||||
QString applicationPath();
|
QString applicationPath();
|
||||||
|
|
||||||
|
|
|
@ -168,9 +168,9 @@ Config::Config(QObject* parent)
|
||||||
}
|
}
|
||||||
|
|
||||||
QDir Config::defaultConfigDir() {
|
QDir Config::defaultConfigDir() {
|
||||||
QString portablePath = QCoreApplication::applicationDirPath().append("/%1");
|
QString portablePath = QCoreApplication::applicationDirPath();
|
||||||
if (QFile::exists(portablePath.arg(".portable")) || QFile::exists(portablePath.arg(".portable.txt"))) {
|
if (Utils::portableFileExists(portablePath)) {
|
||||||
return portablePath.arg("feather_data");
|
return portablePath + "/feather_data";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TailsOS::detect()) {
|
if (TailsOS::detect()) {
|
||||||
|
|
Loading…
Reference in a new issue