From 9f4e08e29c679aae02982cf2ad9a059eb5220616 Mon Sep 17 00:00:00 2001 From: Vinicius Moreira Date: Mon, 29 Nov 2021 10:45:10 -0300 Subject: [PATCH] [appimage] refactoring: removing '/' from INSTALLATION_PATH constant --- bauh/gems/appimage/__init__.py | 2 +- bauh/gems/appimage/controller.py | 4 ++-- bauh/gems/appimage/model.py | 2 +- bauh/gems/appimage/worker.py | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bauh/gems/appimage/__init__.py b/bauh/gems/appimage/__init__.py index 1d8839bc..3338e698 100644 --- a/bauh/gems/appimage/__init__.py +++ b/bauh/gems/appimage/__init__.py @@ -8,7 +8,7 @@ from bauh.commons import resource ROOT_DIR = os.path.dirname(os.path.abspath(__file__)) APPIMAGE_SHARED_DIR = f'{SHARED_FILES_DIR}/appimage' -INSTALLATION_PATH = f'{APPIMAGE_SHARED_DIR}/installed/' +INSTALLATION_PATH = f'{APPIMAGE_SHARED_DIR}/installed' SUGGESTIONS_FILE = f'https://raw.githubusercontent.com/vinifmor/{__app_name__}-files/master/appimage/suggestions.txt' CONFIG_FILE = f'{CONFIG_DIR}/appimage.yml' APPIMAGE_CONFIG_DIR = f'{CONFIG_DIR}/appimage' diff --git a/bauh/gems/appimage/controller.py b/bauh/gems/appimage/controller.py index d7ffb734..36deb041 100644 --- a/bauh/gems/appimage/controller.py +++ b/bauh/gems/appimage/controller.py @@ -254,7 +254,7 @@ class AppImageManager(SoftwareManager): res = SearchResult(installed_apps, [], 0) if os.path.exists(INSTALLATION_PATH): - installed = run_cmd('ls {}*/data.json'.format(INSTALLATION_PATH), print_error=False) + installed = run_cmd(f'ls {INSTALLATION_PATH}/*/data.json', print_error=False) if installed: names = set() @@ -553,7 +553,7 @@ class AppImageManager(SoftwareManager): def _install(self, pkg: AppImage, watcher: ProcessWatcher, pre_downloaded_file: Optional[Tuple[str, str]] = None): handler = ProcessHandler(watcher) - out_dir = INSTALLATION_PATH + pkg.get_clean_name() + out_dir = f'{INSTALLATION_PATH}/{pkg.get_clean_name()}' counter = 0 while True: if os.path.exists(out_dir): diff --git a/bauh/gems/appimage/model.py b/bauh/gems/appimage/model.py index 880268c2..479c58b3 100644 --- a/bauh/gems/appimage/model.py +++ b/bauh/gems/appimage/model.py @@ -94,7 +94,7 @@ class AppImage(SoftwarePackage): if self.install_dir: return self.install_dir elif self.name: - return INSTALLATION_PATH + self.name.lower() + return f'{INSTALLATION_PATH}/{self.name.lower()}' def get_disk_icon_path(self): return self.icon_path diff --git a/bauh/gems/appimage/worker.py b/bauh/gems/appimage/worker.py index 3ffe0f92..58b37a2c 100644 --- a/bauh/gems/appimage/worker.py +++ b/bauh/gems/appimage/worker.py @@ -234,7 +234,7 @@ class SymlinksVerifier(Thread): def run(self): if os.path.exists(INSTALLATION_PATH): - installed_files = glob.glob('{}/*/*.json'.format(INSTALLATION_PATH)) + installed_files = glob.glob(f'{INSTALLATION_PATH}/*/*.json') if installed_files: self.logger.info("Checking installed AppImage files with no symlinks created")