From 8bfdf700d481baf208e390f509ca402a08b114fa Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Mon, 23 Aug 2021 11:21:01 -0300 Subject: [PATCH] [gen.appimage] fix: search is not matching manually installed applications --- CHANGELOG.md | 5 +++++ bauh/gems/appimage/controller.py | 25 ++++++++++++++----------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cf323404..8d4f486a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - adding generic file filter extension (.*) since some desktop environments filters are case sensitive (https://github.com/vinifmor/bauh/issues/185)[#185] - generating a default **.desktop** file based on the installation form for AppImage files that provide empty desktop entries (https://github.com/vinifmor/bauh/issues/186)[#186] +### Fixes +- AppImage + - search: not matching manually installed applications + + ## [0.9.18] 2021-06-18 ### Fixes - Arch diff --git a/bauh/gems/appimage/controller.py b/bauh/gems/appimage/controller.py index af511d2d..a7462183 100644 --- a/bauh/gems/appimage/controller.py +++ b/bauh/gems/appimage/controller.py @@ -214,27 +214,30 @@ class AppImageManager(SoftwareManager): except: self.logger.error("An exception happened while querying the 'apps' database") traceback.print_exc() - apps_conn.close() - return SearchResult.empty() + try: + installed = self.read_installed(connection=apps_conn, disk_loader=disk_loader, limit=limit, only_apps=False, pkg_types=None, internet_available=True).installed + except: + installed = None + installed_found = [] - if not_installed: - installed = self.read_installed(disk_loader=disk_loader, limit=limit, - only_apps=False, - pkg_types=None, - connection=apps_conn, - internet_available=True).installed - if installed: - for appim in installed: - key = self._gen_app_key(appim) + if installed: + lower_words = words.lower() + for appim in installed: + found = False + if not_installed and found_map: + key = self._gen_app_key(appim) new_found = found_map.get(key) if new_found: del not_installed[new_found['idx']] installed_found.append(appim) + found = True + if not found and lower_words in appim.name.lower() or (appim.description and lower_words in appim.description.lower()): + installed_found.append(appim) try: apps_conn.close() except: