mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-20 21:33:27 -07:00
Fix wrong default download directory in Windows. Closes #2625.
This commit is contained in:
parent
4d913d123c
commit
9471d17a65
1 changed files with 58 additions and 44 deletions
|
@ -62,7 +62,7 @@
|
||||||
#include <winbase.h>
|
#include <winbase.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(Q_OS_WIN) || defined(Q_OS_OS2)
|
#ifndef DISABLE_GUI
|
||||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
|
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#else
|
#else
|
||||||
|
@ -464,19 +464,32 @@ QString fsutils::QDesktopServicesCacheLocation() {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString fsutils::QDesktopServicesDownloadLocation() {
|
QString fsutils::QDesktopServicesDownloadLocation()
|
||||||
#if defined(Q_OS_WIN) || defined(Q_OS_OS2)
|
{
|
||||||
|
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||||
|
#if defined(Q_OS_WIN)
|
||||||
|
if (QSysInfo::windowsVersion() <= QSysInfo::WV_XP) // Windows XP
|
||||||
|
return QDir(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation)).absoluteFilePath(
|
||||||
|
QCoreApplication::translate("fsutils", "Downloads"));
|
||||||
|
#endif
|
||||||
|
return QStandardPaths::writableLocation(QStandardPaths::DownloadLocation);
|
||||||
|
#else
|
||||||
|
|
||||||
|
#if defined(Q_OS_OS2)
|
||||||
|
return QDir(QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation)).absoluteFilePath(
|
||||||
|
QCoreApplication::translate("fsutils", "Downloads"));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(Q_OS_WIN)
|
||||||
// as long as it stays WinXP like we do the same on OS/2
|
// as long as it stays WinXP like we do the same on OS/2
|
||||||
// TODO: Use IKnownFolderManager to get path of FOLDERID_Downloads
|
// TODO: Use IKnownFolderManager to get path of FOLDERID_Downloads
|
||||||
// instead of hardcoding "Downloads"
|
// instead of hardcoding "Downloads"
|
||||||
// Unfortunately, this would break compatibility with WinXP
|
// Unfortunately, this would break compatibility with WinXP
|
||||||
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
|
if (QSysInfo::windowsVersion() <= QSysInfo::WV_XP) // Windows XP
|
||||||
return QDir(QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation)).absoluteFilePath(
|
return QDir(QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation)).absoluteFilePath(
|
||||||
QCoreApplication::translate("fsutils", "Downloads"));
|
QCoreApplication::translate("fsutils", "Downloads"));
|
||||||
#else
|
else
|
||||||
return QDir(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation)).absoluteFilePath(
|
return QDir(QDesktopServices::storageLocation(QDesktopServices::HomeLocation)).absoluteFilePath("Downloads");
|
||||||
QCoreApplication::translate("fsutils", "Downloads"));
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC))
|
#if (defined(Q_OS_UNIX) && !defined(Q_OS_MAC))
|
||||||
|
@ -514,12 +527,13 @@ QString fsutils::QDesktopServicesDownloadLocation() {
|
||||||
return save_path;
|
return save_path;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#if defined(Q_OS_MAC)
|
||||||
// TODO: How to support this on Mac OS X?
|
// TODO: How to support this on Mac OS?
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Fallback
|
// Fallback
|
||||||
return QDir::home().absoluteFilePath(QCoreApplication::translate("fsutils", "Downloads"));
|
return QDir::home().absoluteFilePath(QCoreApplication::translate("fsutils", "Downloads"));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
QString fsutils::searchEngineLocation() {
|
QString fsutils::searchEngineLocation() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue