diff --git a/CHANGELOG.md b/CHANGELOG.md index e99a0588..782a222e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). +## [0.9.11] +### Fixes +- AppImage + - some installed applications cannot be launched by their desktop entries (regression from **0.9.10**) [#155](https://github.com/vinifmor/bauh/issues/155). If any of your installed AppImages are affected by this issue, just reinstall them. + ## [0.9.10] 2020-12-11 ### Features - Web diff --git a/bauh/__init__.py b/bauh/__init__.py index 0f620399..99b39f79 100644 --- a/bauh/__init__.py +++ b/bauh/__init__.py @@ -1,4 +1,4 @@ -__version__ = '0.9.10' +__version__ = '0.9.11' __app_name__ = 'bauh' import os diff --git a/bauh/gems/appimage/util.py b/bauh/gems/appimage/util.py index d1a39274..d39fd662 100644 --- a/bauh/gems/appimage/util.py +++ b/bauh/gems/appimage/util.py @@ -26,10 +26,16 @@ def replace_desktop_entry_exec_command(desktop_entry: str, appname: str, file_pa cmd = RE_MANY_SPACES.sub(' ', exec_groups[1].strip()) if cmd: words = cmd.split(' ') + changed = False for idx in range(len(words)): if words[idx].lower() == treated_name: words[idx] = '"{}"'.format(file_path) + changed = True + break + + if not changed: + words = ['"{}"'.format(file_path)] final_entry = final_entry.replace(full_match, full_match.replace(exec_groups[1], ' '.join(words))) diff --git a/tests/gems/appimage/test_util.py b/tests/gems/appimage/test_util.py index 77cbf44b..fa445e0b 100644 --- a/tests/gems/appimage/test_util.py +++ b/tests/gems/appimage/test_util.py @@ -237,3 +237,40 @@ Keywords=PS3;Playstation; """ self.assertEqual(expected, res) + + def test_replace_desktop_entry_exec_command__it_should_replace_the_command_by_the_file_path_if_the_appname_is_not_present(self): + desktop_entry = """ + [Desktop Entry] +Name=GameHub +GenericName=GameHub +Comment=All your games in one place +Categories=Game;Amusement; +Keywords=Game;Hub;Steam;GOG;Humble;HumbleBundle; +Exec=com.github.tkashkin.gamehub +X-GNOME-Gettext-Domain=com.github.tkashkin.gamehub +Icon=/gamehub-0/logo.svg +Terminal=false +Type=Application +X-AppImage-Version=bionic-0.16.0-83-dev-0ca783e + """ + + res = replace_desktop_entry_exec_command(desktop_entry=desktop_entry, + appname='gamehub', + file_path='/path/to/gamehub.appimage') + + expected = """ + [Desktop Entry] +Name=GameHub +GenericName=GameHub +Comment=All your games in one place +Categories=Game;Amusement; +Keywords=Game;Hub;Steam;GOG;Humble;HumbleBundle; +Exec="/path/to/gamehub.appimage" +X-GNOME-Gettext-Domain=com.github.tkashkin.gamehub +Icon=/gamehub-0/logo.svg +Terminal=false +Type=Application +X-AppImage-Version=bionic-0.16.0-83-dev-0ca783e + """ + + self.assertEqual(expected, res)