From a2b0c551c2dd0ada0c212ecc4ea67dd1b5981fbf Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 8 Nov 2022 20:26:54 +0400 Subject: [PATCH] Pass default download path in sandboxed environments. --- Telegram/SourceFiles/core/file_utilities.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Telegram/SourceFiles/core/file_utilities.cpp b/Telegram/SourceFiles/core/file_utilities.cpp index 576d8bc02..f54459ed6 100644 --- a/Telegram/SourceFiles/core/file_utilities.cpp +++ b/Telegram/SourceFiles/core/file_utilities.cpp @@ -173,6 +173,11 @@ QString DefaultDownloadPathFolder(not_null session) { } QString DefaultDownloadPath(not_null session) { + const auto realDefaultPath = QStandardPaths::writableLocation( + QStandardPaths::DownloadLocation) + + '/' + + DefaultDownloadPathFolder(session) + + '/'; if (KSandbox::isInside() && Core::App().settings().downloadPath().isEmpty()) { QStringList files; QByteArray remoteContent; @@ -183,7 +188,7 @@ QString DefaultDownloadPath(not_null session) { tr::lng_download_path_choose(tr::now), QString(), FileDialog::internal::Type::ReadFolder, - QString()); + realDefaultPath); if (success && !files.isEmpty() && !files[0].isEmpty()) { const auto result = files[0].endsWith('/') ? files[0] : (files[0] + '/'); Core::App().settings().setDownloadPath(result); @@ -191,11 +196,7 @@ QString DefaultDownloadPath(not_null session) { return result; } } - return QStandardPaths::writableLocation( - QStandardPaths::DownloadLocation) - + '/' - + DefaultDownloadPathFolder(session) - + '/'; + return realDefaultPath; } namespace internal {