TorManager: set correct dir when Feather is installed

This commit is contained in:
tobtoht 2022-02-25 14:55:39 +01:00
parent dd87b9fe19
commit 87fec5d0f9
No known key found for this signature in database
GPG key ID: 1CADD27F41F45C3C

View file

@ -20,7 +20,12 @@ TorManager::TorManager(QObject *parent)
connect(m_checkConnectionTimer, &QTimer::timeout, this, &TorManager::checkConnection);
this->torDir = Config::defaultConfigDir().filePath("tor");
this->torDataPath = QDir(this->torDir).filePath("data");
#if defined(PLATFORM_INSTALLER)
// When installed, use directory relative to application path.
this->torDir = QDir(Utils::applicationPath()).filePath("tor");
#endif
this->torDataPath = Config::defaultConfigDir().filePath("tor/data");
m_process.setProcessChannelMode(QProcess::MergedChannels);
@ -164,6 +169,11 @@ bool TorManager::unpackBins() {
this->torPath = QDir(this->torDir).filePath(torBin);
#if defined(PLATFORM_INSTALLER)
// We don't need to unpack if Tor was installed using the installer
return true;
#endif
SemanticVersion embeddedVersion = SemanticVersion::fromString(QString(TOR_VERSION));
SemanticVersion filesystemVersion = this->getVersion(torPath);
qDebug() << QString("Tor versions: embedded %1, filesystem %2").arg(embeddedVersion.toString(), filesystemVersion.toString());