Browse Source

Merge pull request #15922 from glassez/fix-paths

Correctly concatenate path components
adaptive-webui-19844
sledgehammer999 3 years ago committed by GitHub
parent
commit
0a1c61d9d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/app/application.cpp
  2. 4
      src/app/upgrade.cpp
  3. 6
      src/base/bittorrent/session.cpp
  4. 4
      src/base/net/geoipmanager.cpp
  5. 4
      src/base/profile_p.cpp
  6. 2
      src/base/rss/rss_autodownloader.cpp
  7. 4
      src/base/rss/rss_session.cpp
  8. 2
      src/base/search/searchpluginmanager.cpp

2
src/app/application.cpp

@ -220,7 +220,7 @@ void Application::setFileLoggerEnabled(const bool value) @@ -220,7 +220,7 @@ void Application::setFileLoggerEnabled(const bool value)
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)

4
src/app/upgrade.cpp

@ -74,10 +74,10 @@ namespace @@ -74,10 +74,10 @@ namespace
const QString configPath {specialFolderLocation(SpecialFolder::Config)};
migrate(QLatin1String("Preferences/WebUI/HTTPS/Certificate")
, 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")
, QLatin1String("Preferences/WebUI/HTTPS/KeyPath")
, Utils::Fs::toNativePath(configPath + QLatin1String("WebUIPrivateKey.pem")));
, Utils::Fs::toNativePath(configPath + QLatin1String("/WebUIPrivateKey.pem")));
}
void upgradeTorrentContentLayout()

6
src/base/bittorrent/session.cpp

@ -4313,7 +4313,7 @@ void Session::startUpTorrents() @@ -4313,7 +4313,7 @@ void Session::startUpTorrents()
qDebug("Initializing torrents resume data storage...");
const QString dbPath = Utils::Fs::expandPathAbs(
specialFolderLocation(SpecialFolder::Data) + QLatin1String("torrents.db"));
specialFolderLocation(SpecialFolder::Data) + QLatin1String("/torrents.db"));
const bool dbStorageExists = QFile::exists(dbPath);
ResumeDataStorage *startupStorage = nullptr;
@ -4324,14 +4324,14 @@ void Session::startUpTorrents() @@ -4324,14 +4324,14 @@ void Session::startUpTorrents()
if (!dbStorageExists)
{
const QString dataPath = Utils::Fs::expandPathAbs(
specialFolderLocation(SpecialFolder::Data) + QLatin1String("BT_backup"));
specialFolderLocation(SpecialFolder::Data) + QLatin1String("/BT_backup"));
startupStorage = new BencodeResumeDataStorage(dataPath, this);
}
}
else
{
const QString dataPath = Utils::Fs::expandPathAbs(
specialFolderLocation(SpecialFolder::Data) + QLatin1String("BT_backup"));
specialFolderLocation(SpecialFolder::Data) + QLatin1String("/BT_backup"));
m_resumeDataStorage = new BencodeResumeDataStorage(dataPath, this);
if (dbStorageExists)

4
src/base/net/geoipmanager.cpp

@ -89,7 +89,7 @@ void GeoIPManager::loadDatabase() @@ -89,7 +89,7 @@ void GeoIPManager::loadDatabase()
m_geoIPDatabase = nullptr;
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;
m_geoIPDatabase = GeoIPDatabase::load(filepath, error);
@ -448,7 +448,7 @@ void GeoIPManager::downloadFinished(const DownloadResult &result) @@ -448,7 +448,7 @@ void GeoIPManager::downloadFinished(const DownloadResult &result)
.arg(m_geoIPDatabase->type(), m_geoIPDatabase->buildEpoch().toString()),
Log::INFO);
const QString targetPath = Utils::Fs::expandPathAbs(
specialFolderLocation(SpecialFolder::Data) + GEODB_FOLDER);
QDir(specialFolderLocation(SpecialFolder::Data)).absoluteFilePath(GEODB_FOLDER));
if (!QDir(targetPath).exists())
QDir().mkpath(targetPath);

4
src/base/profile_p.cpp

@ -88,10 +88,10 @@ QString Private::DefaultProfile::dataLocation() const @@ -88,10 +88,10 @@ QString Private::DefaultProfile::dataLocation() const
#else
// On Linux keep using the legacy directory ~/.local/share/data/ if it exists
const QString legacyDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)
+ QLatin1String("/data/") + profileName() + QLatin1Char('/');
+ QLatin1String("/data/") + profileName();
const QString dataDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)
+ QLatin1Char('/') + profileName() + QLatin1Char('/');
+ QLatin1Char('/') + profileName();
if (!QDir(dataDir).exists() && QDir(legacyDir).exists())
{

2
src/base/rss/rss_autodownloader.cpp

@ -108,7 +108,7 @@ AutoDownloader::AutoDownloader() @@ -108,7 +108,7 @@ AutoDownloader::AutoDownloader()
m_instance = this;
m_fileStorage = new AsyncFileStorage(
Utils::Fs::expandPathAbs(specialFolderLocation(SpecialFolder::Config) + ConfFolderName));
Utils::Fs::expandPathAbs(specialFolderLocation(SpecialFolder::Config) + QLatin1Char('/') + ConfFolderName));
if (!m_fileStorage)
throw RuntimeError(tr("Directory for RSS AutoDownloader data is unavailable."));

4
src/base/rss/rss_session.cpp

@ -67,7 +67,7 @@ Session::Session() @@ -67,7 +67,7 @@ Session::Session()
m_instance = this;
m_confFileStorage = new AsyncFileStorage(
Utils::Fs::expandPathAbs(specialFolderLocation(SpecialFolder::Config) + ConfFolderName));
Utils::Fs::expandPathAbs(specialFolderLocation(SpecialFolder::Config) + QLatin1Char('/') + ConfFolderName));
m_confFileStorage->moveToThread(m_workingThread);
connect(m_workingThread, &QThread::finished, m_confFileStorage, &AsyncFileStorage::deleteLater);
connect(m_confFileStorage, &AsyncFileStorage::failed, [](const QString &fileName, const QString &errorString)
@ -77,7 +77,7 @@ Session::Session() @@ -77,7 +77,7 @@ Session::Session()
});
m_dataFileStorage = new AsyncFileStorage(
Utils::Fs::expandPathAbs(specialFolderLocation(SpecialFolder::Data) + DataFolderName));
Utils::Fs::expandPathAbs(specialFolderLocation(SpecialFolder::Data) + QLatin1Char('/') + DataFolderName));
m_dataFileStorage->moveToThread(m_workingThread);
connect(m_workingThread, &QThread::finished, m_dataFileStorage, &AsyncFileStorage::deleteLater);
connect(m_dataFileStorage, &AsyncFileStorage::failed, [](const QString &fileName, const QString &errorString)

2
src/base/search/searchpluginmanager.cpp

@ -367,7 +367,7 @@ QString SearchPluginManager::engineLocation() @@ -367,7 +367,7 @@ QString SearchPluginManager::engineLocation()
static QString location;
if (location.isEmpty())
{
location = Utils::Fs::expandPathAbs(specialFolderLocation(SpecialFolder::Data) + "nova3");
location = Utils::Fs::expandPathAbs(specialFolderLocation(SpecialFolder::Data) + "/nova3");
const QDir locationDir(location);
locationDir.mkpath(locationDir.absolutePath());

Loading…
Cancel
Save