From 1c7bfcac463db08291a95edebcbdf9eb5e7df42a Mon Sep 17 00:00:00 2001 From: lbilli Date: Thu, 12 Dec 2019 09:56:16 -0500 Subject: [PATCH] Don't create 'data' subdirectory on Linux --- CONTRIBUTING.md | 2 +- src/base/profile_p.cpp | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 620fa933f..a14e4ff3e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -138,7 +138,7 @@ These are unstable/unsupported platforms, and in all likelihood, whatever the is * **For performance-related issues**, include as much profiling data as you can (resource usage graphs, etc). * Paste the **qBittorrent log** (or put the contents of the log in a gist and provide a link to the gist). The log can be viewed in the GUI (View -> Log -> tick all boxes). If you can't do that, the file is at: - - Linux: `~/.local/share/data/qBittorrent/logs/qBittorrent.log` + - Linux: `~/.local/share/qBittorrent/logs/qBittorrent.log` - Windows: `%LocalAppData%\qBittorrent\logs` - macOS: `~/Library/Application Support/qBittorrent/qBittorrent.log` diff --git a/src/base/profile_p.cpp b/src/base/profile_p.cpp index e930dac4d..4ba1b5261 100644 --- a/src/base/profile_p.cpp +++ b/src/base/profile_p.cpp @@ -76,9 +76,21 @@ QString Private::DefaultProfile::dataLocation() const #if defined(Q_OS_WIN) || defined (Q_OS_MACOS) return locationWithConfigurationName(QStandardPaths::AppLocalDataLocation); #else - // on Linux gods know why qBittorrent creates 'data' subdirectory in ~/.local/share/ - return QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + // On Linux keep using the legacy directory ~/.local/share/data/ if it exists + const QString legacyDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + QLatin1String("/data/") + profileName() + QLatin1Char('/'); + + const QString dataDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + + QLatin1Char('/') + profileName() + QLatin1Char('/'); + + if (QDir(legacyDir).exists()) { + qWarning("The legacy data directory '%s' is used. It is recommended to move its content to '%s'", + qUtf8Printable(legacyDir), qUtf8Printable(dataDir)); + + return legacyDir; + } + + return dataDir; #endif }