mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-30 22:16:14 +00:00
Better check for download path availability in sandbox
This commit is contained in:
@@ -91,6 +91,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "boxes/premium_limits_box.h"
|
||||
#include "ui/boxes/confirm_box.h"
|
||||
|
||||
#include <QtCore/QStandardPaths>
|
||||
#include <QtCore/QMimeDatabase>
|
||||
#include <QtGui/QGuiApplication>
|
||||
#include <QtGui/QScreen>
|
||||
@@ -251,6 +252,15 @@ void Application::run() {
|
||||
return;
|
||||
}
|
||||
|
||||
if (KSandbox::isInside()) {
|
||||
const auto path = settings().downloadPath();
|
||||
if (!path.isEmpty()
|
||||
&& path != qstr("tmp")
|
||||
&& !base::CanReadDirectory(path)) {
|
||||
settings().setDownloadPath(QString());
|
||||
}
|
||||
}
|
||||
|
||||
_translator = std::make_unique<Lang::Translator>();
|
||||
QCoreApplication::instance()->installTranslator(_translator.get());
|
||||
|
||||
@@ -589,9 +599,15 @@ void Application::saveSettings() {
|
||||
}
|
||||
|
||||
bool Application::canSaveFileWithoutAskingForPath() const {
|
||||
return !Core::App().settings().askDownloadPath()
|
||||
&& (!KSandbox::isInside()
|
||||
|| !Core::App().settings().downloadPath().isEmpty());
|
||||
if (Core::App().settings().askDownloadPath()) {
|
||||
return false;
|
||||
} else if (KSandbox::isInside()
|
||||
&& Core::App().settings().downloadPath().isEmpty()) {
|
||||
const auto path = QStandardPaths::writableLocation(
|
||||
QStandardPaths::DownloadLocation);
|
||||
return base::CanReadDirectory(path);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
MTP::Config &Application::fallbackProductionConfig() const {
|
||||
|
Reference in New Issue
Block a user