From c1f7194b44a2186f723c85e215e57dfa677538c0 Mon Sep 17 00:00:00 2001 From: Yuhang Zhao <2546789017@qq.com> Date: Wed, 5 Jan 2022 17:13:31 +0800 Subject: [PATCH] QStandardPaths_win: Add mapping for DownloadLocation Un-special-case for DownloadLocation. I assume the original code is written like that to be compatible with some really old versions of Windows. Change-Id: I643401910bae9a061f2e02c651971b4f2dd46901 Reviewed-by: Kai Koehne --- src/corelib/io/qstandardpaths_win.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/corelib/io/qstandardpaths_win.cpp b/src/corelib/io/qstandardpaths_win.cpp index 0d24ed3ce92..2ddf4a5fe1b 100644 --- a/src/corelib/io/qstandardpaths_win.cpp +++ b/src/corelib/io/qstandardpaths_win.cpp @@ -130,7 +130,8 @@ static GUID writableSpecialFolderId(QStandardPaths::StandardLocation type) FOLDERID_LocalAppData, // GenericDataLocation ("Local" path) GUID(), // RuntimeLocation FOLDERID_LocalAppData, // ConfigLocation ("Local" path) - GUID(), GUID(), // DownloadLocation/GenericCacheLocation + FOLDERID_Downloads, // DownloadLocation + GUID(), // GenericCacheLocation FOLDERID_LocalAppData, // GenericConfigLocation ("Local" path) FOLDERID_RoamingAppData,// AppDataLocation ("Roaming" path) FOLDERID_LocalAppData, // AppConfigLocation ("Local" path) @@ -154,7 +155,8 @@ static GUID writableSpecialFolderId(QStandardPaths::StandardLocation type) FOLDERID_LocalAppDataLow,// GenericDataLocation ("Local" path) GUID(), // RuntimeLocation FOLDERID_LocalAppDataLow,// ConfigLocation ("Local" path) - GUID(), GUID(), // DownloadLocation/GenericCacheLocation + FOLDERID_Downloads, // DownloadLocation + GUID(), // GenericCacheLocation FOLDERID_LocalAppDataLow,// GenericConfigLocation ("Local" path) FOLDERID_RoamingAppData, // AppDataLocation ("Roaming" path) FOLDERID_LocalAppDataLow,// AppConfigLocation ("Local" path) @@ -185,12 +187,6 @@ QString QStandardPaths::writableLocation(StandardLocation type) { QString result; switch (type) { - case DownloadLocation: - result = sHGetKnownFolderPath(FOLDERID_Downloads); - if (result.isEmpty()) - result = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation); - break; - case CacheLocation: // Although Microsoft has a Cache key it is a pointer to IE's cache, not a cache // location for everyone. Most applications seem to be using a