mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-15 21:57:10 +02:00
Pass default download path in sandboxed environments.
This commit is contained in:
parent
bff641c217
commit
a2b0c551c2
1 changed files with 7 additions and 6 deletions
|
@ -173,6 +173,11 @@ QString DefaultDownloadPathFolder(not_null<Main::Session*> session) {
|
|||
}
|
||||
|
||||
QString DefaultDownloadPath(not_null<Main::Session*> 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<Main::Session*> 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<Main::Session*> session) {
|
|||
return result;
|
||||
}
|
||||
}
|
||||
return QStandardPaths::writableLocation(
|
||||
QStandardPaths::DownloadLocation)
|
||||
+ '/'
|
||||
+ DefaultDownloadPathFolder(session)
|
||||
+ '/';
|
||||
return realDefaultPath;
|
||||
}
|
||||
|
||||
namespace internal {
|
||||
|
|
Loading…
Add table
Reference in a new issue