From e2e40747a5e3e59035e2db3e2d5f4f3fcfb94545 Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Sat, 2 May 2020 11:45:30 -0300 Subject: [PATCH] [fix][arch] file not found error while organizing the data of installed packages --- CHANGELOG.md | 5 +++++ bauh/gems/arch/disk.py | 9 +++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c4c300dc..021936db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - the dialog is now displayed before the upgrading process (but the operation is only executed after a successful upgrade) - Settings - new option to disable the reboot dialog after a successful upgrade (`updates.ask_for_reboot`) + +### Fixes +- Arch + - file not found error while organizing the data of installed packages [#101](https://github.com/vinifmor/bauh/issues/101) + ### UI - icons, buttons and colors changes - removed more unnecessary **x** buttons from some dialogs diff --git a/bauh/gems/arch/disk.py b/bauh/gems/arch/disk.py index fbb7fb1a..423bd6e2 100644 --- a/bauh/gems/arch/disk.py +++ b/bauh/gems/arch/disk.py @@ -71,7 +71,7 @@ def save_several(pkgnames: Iterable[str], repo_map: Dict[str, str], overwrite: b raise for f in desktop_files: - if ends_with.match(f): + if ends_with.match(f) and os.path.isfile(f): desktop_matches[pkg] = f break @@ -82,13 +82,14 @@ def save_several(pkgnames: Iterable[str], repo_map: Dict[str, str], overwrite: b entries = pacman.list_desktop_entries({pkg}) if entries: - desktop_matches[pkg] = entries[0] - if len(entries) > 1: for e in entries: - if e.startswith('/usr/share/applications'): + if e.startswith('/usr/share/applications') and os.path.isfile(e): desktop_matches[pkg] = e break + else: + if os.path.isfile(entries[0]): + desktop_matches[pkg] = entries[0] if not desktop_matches: no_desktop_files = to_cache