diff --git a/Applications/FileManager/DirectoryView.cpp b/Applications/FileManager/DirectoryView.cpp index a9391c7c3cf..af5570f02d0 100644 --- a/Applications/FileManager/DirectoryView.cpp +++ b/Applications/FileManager/DirectoryView.cpp @@ -68,8 +68,9 @@ void DirectoryView::handle_activation(const GModelIndex& index) return; } - // FIXME: This doesn't seem like the right way to fully detect executability. - if (st.st_mode & S_IXUSR) { + ASSERT(!S_ISLNK(st.st_mode)); + + if (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)) { if (fork() == 0) { int rc = execl(path.characters(), path.characters(), nullptr); if (rc < 0) diff --git a/Libraries/LibGUI/GFileSystemModel.cpp b/Libraries/LibGUI/GFileSystemModel.cpp index c0ed10eb8cf..ed532d5500e 100644 --- a/Libraries/LibGUI/GFileSystemModel.cpp +++ b/Libraries/LibGUI/GFileSystemModel.cpp @@ -415,7 +415,7 @@ GIcon GFileSystemModel::icon_for_file(const mode_t mode, const String& name) con return m_symlink_icon; if (S_ISSOCK(mode)) return m_socket_icon; - if (mode & S_IXUSR) + if (mode & (S_IXUSR | S_IXGRP | S_IXOTH)) return m_executable_icon; if (name.to_lowercase().ends_with(".wav")) return m_filetype_sound_icon; diff --git a/Libraries/LibGUI/GFileSystemModel.h b/Libraries/LibGUI/GFileSystemModel.h index 4c01bf32cd7..276c99df506 100644 --- a/Libraries/LibGUI/GFileSystemModel.h +++ b/Libraries/LibGUI/GFileSystemModel.h @@ -73,7 +73,7 @@ public: mutable RefPtr thumbnail; bool is_directory() const { return S_ISDIR(mode); } - bool is_executable() const { return mode & S_IXUSR; } + bool is_executable() const { return mode & (S_IXUSR | S_IXGRP | S_IXOTH); } String full_path(const GFileSystemModel&) const;