mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 07:18:08 +00:00
Correctly concatenate path components
This commit is contained in:
parent
7e8a176751
commit
fdbf8cb0ee
@ -220,7 +220,7 @@ void Application::setFileLoggerEnabled(const bool value)
|
|||||||
|
|
||||||
QString Application::fileLoggerPath() const
|
QString Application::fileLoggerPath() const
|
||||||
{
|
{
|
||||||
return m_storeFileLoggerPath.get(specialFolderLocation(SpecialFolder::Data) + LOG_FOLDER);
|
return m_storeFileLoggerPath.get(QDir(specialFolderLocation(SpecialFolder::Data)).absoluteFilePath(LOG_FOLDER));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::setFileLoggerPath(const QString &path)
|
void Application::setFileLoggerPath(const QString &path)
|
||||||
|
@ -74,10 +74,10 @@ namespace
|
|||||||
const QString configPath {specialFolderLocation(SpecialFolder::Config)};
|
const QString configPath {specialFolderLocation(SpecialFolder::Config)};
|
||||||
migrate(QLatin1String("Preferences/WebUI/HTTPS/Certificate")
|
migrate(QLatin1String("Preferences/WebUI/HTTPS/Certificate")
|
||||||
, QLatin1String("Preferences/WebUI/HTTPS/CertificatePath")
|
, QLatin1String("Preferences/WebUI/HTTPS/CertificatePath")
|
||||||
, Utils::Fs::toNativePath(configPath + QLatin1String("WebUICertificate.crt")));
|
, Utils::Fs::toNativePath(configPath + QLatin1String("/WebUICertificate.crt")));
|
||||||
migrate(QLatin1String("Preferences/WebUI/HTTPS/Key")
|
migrate(QLatin1String("Preferences/WebUI/HTTPS/Key")
|
||||||
, QLatin1String("Preferences/WebUI/HTTPS/KeyPath")
|
, QLatin1String("Preferences/WebUI/HTTPS/KeyPath")
|
||||||
, Utils::Fs::toNativePath(configPath + QLatin1String("WebUIPrivateKey.pem")));
|
, Utils::Fs::toNativePath(configPath + QLatin1String("/WebUIPrivateKey.pem")));
|
||||||
}
|
}
|
||||||
|
|
||||||
void upgradeTorrentContentLayout()
|
void upgradeTorrentContentLayout()
|
||||||
|
@ -4313,7 +4313,7 @@ void Session::startUpTorrents()
|
|||||||
qDebug("Initializing torrents resume data storage...");
|
qDebug("Initializing torrents resume data storage...");
|
||||||
|
|
||||||
const QString dbPath = Utils::Fs::expandPathAbs(
|
const QString dbPath = Utils::Fs::expandPathAbs(
|
||||||
specialFolderLocation(SpecialFolder::Data) + QLatin1String("torrents.db"));
|
specialFolderLocation(SpecialFolder::Data) + QLatin1String("/torrents.db"));
|
||||||
const bool dbStorageExists = QFile::exists(dbPath);
|
const bool dbStorageExists = QFile::exists(dbPath);
|
||||||
|
|
||||||
ResumeDataStorage *startupStorage = nullptr;
|
ResumeDataStorage *startupStorage = nullptr;
|
||||||
@ -4324,14 +4324,14 @@ void Session::startUpTorrents()
|
|||||||
if (!dbStorageExists)
|
if (!dbStorageExists)
|
||||||
{
|
{
|
||||||
const QString dataPath = Utils::Fs::expandPathAbs(
|
const QString dataPath = Utils::Fs::expandPathAbs(
|
||||||
specialFolderLocation(SpecialFolder::Data) + QLatin1String("BT_backup"));
|
specialFolderLocation(SpecialFolder::Data) + QLatin1String("/BT_backup"));
|
||||||
startupStorage = new BencodeResumeDataStorage(dataPath, this);
|
startupStorage = new BencodeResumeDataStorage(dataPath, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const QString dataPath = Utils::Fs::expandPathAbs(
|
const QString dataPath = Utils::Fs::expandPathAbs(
|
||||||
specialFolderLocation(SpecialFolder::Data) + QLatin1String("BT_backup"));
|
specialFolderLocation(SpecialFolder::Data) + QLatin1String("/BT_backup"));
|
||||||
m_resumeDataStorage = new BencodeResumeDataStorage(dataPath, this);
|
m_resumeDataStorage = new BencodeResumeDataStorage(dataPath, this);
|
||||||
|
|
||||||
if (dbStorageExists)
|
if (dbStorageExists)
|
||||||
|
@ -89,7 +89,7 @@ void GeoIPManager::loadDatabase()
|
|||||||
m_geoIPDatabase = nullptr;
|
m_geoIPDatabase = nullptr;
|
||||||
|
|
||||||
const QString filepath = Utils::Fs::expandPathAbs(
|
const QString filepath = Utils::Fs::expandPathAbs(
|
||||||
QString::fromLatin1("%1%2/%3").arg(specialFolderLocation(SpecialFolder::Data), GEODB_FOLDER, GEODB_FILENAME));
|
QString::fromLatin1("%1/%2/%3").arg(specialFolderLocation(SpecialFolder::Data), GEODB_FOLDER, GEODB_FILENAME));
|
||||||
|
|
||||||
QString error;
|
QString error;
|
||||||
m_geoIPDatabase = GeoIPDatabase::load(filepath, error);
|
m_geoIPDatabase = GeoIPDatabase::load(filepath, error);
|
||||||
@ -448,7 +448,7 @@ void GeoIPManager::downloadFinished(const DownloadResult &result)
|
|||||||
.arg(m_geoIPDatabase->type(), m_geoIPDatabase->buildEpoch().toString()),
|
.arg(m_geoIPDatabase->type(), m_geoIPDatabase->buildEpoch().toString()),
|
||||||
Log::INFO);
|
Log::INFO);
|
||||||
const QString targetPath = Utils::Fs::expandPathAbs(
|
const QString targetPath = Utils::Fs::expandPathAbs(
|
||||||
specialFolderLocation(SpecialFolder::Data) + GEODB_FOLDER);
|
QDir(specialFolderLocation(SpecialFolder::Data)).absoluteFilePath(GEODB_FOLDER));
|
||||||
if (!QDir(targetPath).exists())
|
if (!QDir(targetPath).exists())
|
||||||
QDir().mkpath(targetPath);
|
QDir().mkpath(targetPath);
|
||||||
|
|
||||||
|
@ -88,10 +88,10 @@ QString Private::DefaultProfile::dataLocation() const
|
|||||||
#else
|
#else
|
||||||
// On Linux keep using the legacy directory ~/.local/share/data/ if it exists
|
// On Linux keep using the legacy directory ~/.local/share/data/ if it exists
|
||||||
const QString legacyDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)
|
const QString legacyDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)
|
||||||
+ QLatin1String("/data/") + profileName() + QLatin1Char('/');
|
+ QLatin1String("/data/") + profileName();
|
||||||
|
|
||||||
const QString dataDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)
|
const QString dataDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)
|
||||||
+ QLatin1Char('/') + profileName() + QLatin1Char('/');
|
+ QLatin1Char('/') + profileName();
|
||||||
|
|
||||||
if (!QDir(dataDir).exists() && QDir(legacyDir).exists())
|
if (!QDir(dataDir).exists() && QDir(legacyDir).exists())
|
||||||
{
|
{
|
||||||
|
@ -108,7 +108,7 @@ AutoDownloader::AutoDownloader()
|
|||||||
m_instance = this;
|
m_instance = this;
|
||||||
|
|
||||||
m_fileStorage = new AsyncFileStorage(
|
m_fileStorage = new AsyncFileStorage(
|
||||||
Utils::Fs::expandPathAbs(specialFolderLocation(SpecialFolder::Config) + ConfFolderName));
|
Utils::Fs::expandPathAbs(specialFolderLocation(SpecialFolder::Config) + QLatin1Char('/') + ConfFolderName));
|
||||||
if (!m_fileStorage)
|
if (!m_fileStorage)
|
||||||
throw RuntimeError(tr("Directory for RSS AutoDownloader data is unavailable."));
|
throw RuntimeError(tr("Directory for RSS AutoDownloader data is unavailable."));
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ Session::Session()
|
|||||||
m_instance = this;
|
m_instance = this;
|
||||||
|
|
||||||
m_confFileStorage = new AsyncFileStorage(
|
m_confFileStorage = new AsyncFileStorage(
|
||||||
Utils::Fs::expandPathAbs(specialFolderLocation(SpecialFolder::Config) + ConfFolderName));
|
Utils::Fs::expandPathAbs(specialFolderLocation(SpecialFolder::Config) + QLatin1Char('/') + ConfFolderName));
|
||||||
m_confFileStorage->moveToThread(m_workingThread);
|
m_confFileStorage->moveToThread(m_workingThread);
|
||||||
connect(m_workingThread, &QThread::finished, m_confFileStorage, &AsyncFileStorage::deleteLater);
|
connect(m_workingThread, &QThread::finished, m_confFileStorage, &AsyncFileStorage::deleteLater);
|
||||||
connect(m_confFileStorage, &AsyncFileStorage::failed, [](const QString &fileName, const QString &errorString)
|
connect(m_confFileStorage, &AsyncFileStorage::failed, [](const QString &fileName, const QString &errorString)
|
||||||
@ -77,7 +77,7 @@ Session::Session()
|
|||||||
});
|
});
|
||||||
|
|
||||||
m_dataFileStorage = new AsyncFileStorage(
|
m_dataFileStorage = new AsyncFileStorage(
|
||||||
Utils::Fs::expandPathAbs(specialFolderLocation(SpecialFolder::Data) + DataFolderName));
|
Utils::Fs::expandPathAbs(specialFolderLocation(SpecialFolder::Data) + QLatin1Char('/') + DataFolderName));
|
||||||
m_dataFileStorage->moveToThread(m_workingThread);
|
m_dataFileStorage->moveToThread(m_workingThread);
|
||||||
connect(m_workingThread, &QThread::finished, m_dataFileStorage, &AsyncFileStorage::deleteLater);
|
connect(m_workingThread, &QThread::finished, m_dataFileStorage, &AsyncFileStorage::deleteLater);
|
||||||
connect(m_dataFileStorage, &AsyncFileStorage::failed, [](const QString &fileName, const QString &errorString)
|
connect(m_dataFileStorage, &AsyncFileStorage::failed, [](const QString &fileName, const QString &errorString)
|
||||||
|
@ -367,7 +367,7 @@ QString SearchPluginManager::engineLocation()
|
|||||||
static QString location;
|
static QString location;
|
||||||
if (location.isEmpty())
|
if (location.isEmpty())
|
||||||
{
|
{
|
||||||
location = Utils::Fs::expandPathAbs(specialFolderLocation(SpecialFolder::Data) + "nova3");
|
location = Utils::Fs::expandPathAbs(specialFolderLocation(SpecialFolder::Data) + "/nova3");
|
||||||
|
|
||||||
const QDir locationDir(location);
|
const QDir locationDir(location);
|
||||||
locationDir.mkpath(locationDir.absolutePath());
|
locationDir.mkpath(locationDir.absolutePath());
|
||||||
|
Loading…
Reference in New Issue
Block a user