diff options
| author | isanae <14251494+isanae@users.noreply.github.com> | 2019-12-02 13:51:46 -0500 |
|---|---|---|
| committer | isanae <14251494+isanae@users.noreply.github.com> | 2019-12-02 13:51:46 -0500 |
| commit | d4172dc5f8c642dbbe235a86a28992af310e703a (patch) | |
| tree | 21eb9f6cc16d9f35cebb2a93c786c17a3a66ea4c /src/modinfodialog.cpp | |
| parent | 2b4d7929769a91d9de30e1e10319d1c9cf0450af (diff) | |
added "open with vfs" option to conflicts tab
Diffstat (limited to 'src/modinfodialog.cpp')
| -rw-r--r-- | src/modinfodialog.cpp | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/modinfodialog.cpp b/src/modinfodialog.cpp index c7e071ad..f5ca1de7 100644 --- a/src/modinfodialog.cpp +++ b/src/modinfodialog.cpp @@ -61,10 +61,27 @@ bool canPreviewFile( return pluginContainer.previewGenerator().previewSupported(ext); } -bool canOpenFile(bool isArchive, const QString&) +bool isExecutableFilename(const QString& filename) { - // can open anything as long as it's not in an archive - return !isArchive; + static const std::set<QString> exeExtensions = { + "exe", "cmd", "bat" + }; + + const auto ext = QFileInfo(filename).suffix().toLower(); + + return exeExtensions.contains(ext); +} + +bool canRunFile(bool isArchive, const QString& filename) +{ + // can run executables that are not archives + return !isArchive && isExecutableFilename(filename); +} + +bool canOpenFile(bool isArchive, const QString& filename) +{ + // can open non-executables that are not archives + return !isArchive && !isExecutableFilename(filename); } bool canExploreFile(bool isArchive, const QString&) |
