1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 20:37:34 +00:00

Assistant: Check for access before showing results

This commit is contained in:
Hugh Davenport 2024-01-05 17:44:03 +13:00 committed by Andrew Kaster
parent 6f6a2dc319
commit 7c88ab2836

View file

@ -66,7 +66,9 @@ void URLResult::activate() const
AppProvider::AppProvider() AppProvider::AppProvider()
{ {
Desktop::AppFile::for_each([this](NonnullRefPtr<Desktop::AppFile> app_file) { Desktop::AppFile::for_each([this](NonnullRefPtr<Desktop::AppFile> app_file) {
m_app_file_cache.append(move(app_file)); if (access(app_file->executable().characters(), X_OK) == 0) {
m_app_file_cache.append(move(app_file));
}
}); });
} }
@ -224,6 +226,10 @@ void FileProvider::build_filesystem_cache()
return IterationDecision::Continue; return IterationDecision::Continue;
auto full_path = LexicalPath::join(directory.path().string(), entry.name).string(); auto full_path = LexicalPath::join(directory.path().string(), entry.name).string();
if (access(full_path.characters(), X_OK) != 0)
return IterationDecision::Continue;
m_full_path_cache.append(full_path); m_full_path_cache.append(full_path);
if (S_ISDIR(st.st_mode)) { if (S_ISDIR(st.st_mode)) {