mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Show 'Open With' for files without extension.
This commit is contained in:
parent
f316d951ae
commit
515d8e78da
1 changed files with 14 additions and 2 deletions
|
@ -29,6 +29,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "storage/file_download_mtproto.h"
|
#include "storage/file_download_mtproto.h"
|
||||||
#include "storage/file_download_web.h"
|
#include "storage/file_download_web.h"
|
||||||
#include "platform/platform_specific.h"
|
#include "platform/platform_specific.h"
|
||||||
|
#include "platform/platform_file_utilities.h"
|
||||||
|
#include "base/platform/base_platform_info.h"
|
||||||
#include "history/history.h"
|
#include "history/history.h"
|
||||||
#include "history/history_item.h"
|
#include "history/history_item.h"
|
||||||
#include "history/view/media/history_view_gif.h"
|
#include "history/view/media/history_view_gif.h"
|
||||||
|
@ -80,11 +82,21 @@ void LaunchWithWarning(
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}();
|
}();
|
||||||
if (!warn) {
|
const auto extension = '.' + Data::FileExtension(name);
|
||||||
|
if (Platform::IsWindows() && extension == u"."_q) {
|
||||||
|
// If you launch a file without extension, like "test", in case
|
||||||
|
// there is an executable file with the same name in this folder,
|
||||||
|
// like "test.bat", the executable file will be launched.
|
||||||
|
//
|
||||||
|
// Now we always force an Open With dialog box for such files.
|
||||||
|
crl::on_main([=] {
|
||||||
|
Platform::File::UnsafeShowOpenWith(name);
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
} else if (!warn) {
|
||||||
File::Launch(name);
|
File::Launch(name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto extension = '.' + Data::FileExtension(name);
|
|
||||||
const auto callback = [=](bool checked) {
|
const auto callback = [=](bool checked) {
|
||||||
if (checked) {
|
if (checked) {
|
||||||
Core::App().settings().setExeLaunchWarning(false);
|
Core::App().settings().setExeLaunchWarning(false);
|
||||||
|
|
Loading…
Add table
Reference in a new issue