]> Nutra Git (v2) - gamesguru/feather.git/commitdiff
TorManager: TOR_INSTALLED, set fallback tor dir
authortobtoht <tob@featherwallet.org>
Fri, 21 Apr 2023 20:27:09 +0000 (22:27 +0200)
committertobtoht <tob@featherwallet.org>
Fri, 21 Apr 2023 20:27:09 +0000 (22:27 +0200)
src/utils/TorManager.cpp

index 21d6b8f3dff64d0a82ce82bad8f3e720ac2bd12b..c3e0dacf4758e32285873cd2ee183d25065aa53d 100644 (file)
@@ -21,9 +21,15 @@ TorManager::TorManager(QObject *parent)
     connect(m_checkConnectionTimer, &QTimer::timeout, this, &TorManager::checkConnection);
 
     this->torDir = Config::defaultConfigDir().filePath("tor");
+
 #if defined(TOR_INSTALLED)
-    // When installed, use directory relative to application path.
-    this->torDir = QDir(Utils::applicationPath()).filePath("tor");
+    QString installedTorPath = QDir(Utils::applicationPath()).filePath("tor");
+    bool installedTorPathIsDir = QFileInfo(torPath).isDir();
+    if (installedTorPathIsDir) {
+        this->torDir = installedTorPath;
+    } else {
+        this->torDir = Utils::applicationPath();
+    }
 #endif
 
     this->torDataPath = Config::defaultConfigDir().filePath("tor/data");