-
-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Search for desktop files in all subdirectories of app dirs #370
Conversation
Do not merge yet. I need to fix something |
Ok, it's fixed now. I've moved the seen directory check to be better optimized. |
file_path = os.path.realpath(os.path.join(d, file_name)) | ||
if os.path.isdir(file_path): | ||
app_dirs.insert(0, file_path) | ||
continue | ||
__process_desktop_file(file_path) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: you could add
if not os.path.exists(file_path):
continue
to avoid a crash on launch if the directory contains a broken symlink
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very good idea. I haven't thought of that case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pol-rivero I've also been thinking whether or not check if the file has a .desktop
extension before passing it to __process_desktop_file
method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also had the same doubt when writing it originally, by decided not to check it for 2 reasons:
- It's not necessary. If our code works fine without this restriction, we shouldn't enforce it (see Robustness principle).
- The Desktop Entry Specification technically does allow desktop files to use extensions other than
.desktop
(notice the use of "Desktop entry files should have the .desktop extension" instead of "must" or equivalent).
I've added check if the file exists. |
Sounds good! This should now cover lots of edge cases. Looks good to merge. |
Very well then. |
Fixes #367