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
Notes: sideshowbarker 2024-07-17 00:53:02 +09:00

View File

@ -66,7 +66,9 @@ void URLResult::activate() const
AppProvider::AppProvider()
{
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;
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);
if (S_ISDIR(st.st_mode)) {