[appimage] fix: not able to launch AppImage files installed inside folders named with spaces

This commit is contained in:
Vinicius Moreira
2020-11-30 18:52:55 -03:00
parent ef28a18d02
commit 24d14e41bc
4 changed files with 17 additions and 6 deletions

View File

@@ -50,10 +50,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- new parameter **--offline**: it assumes the internet connection is off. Useful if the connection is bad/unstable and you just want to check your installed packages.
### Fixes
- Arch:
- AppImage
- not able to launch AppImage files installed inside folders named with spaces (e.g: "/path/my folder/abc.appimage")
- Arch
- search: not able to find installed packages that were renamed on the repositories (e.g: xapps -> xapp)
- not able to replace an installed package for a new one that replaces it during conflict resolutions (e.g: xapp replaces xapps)
- AUR: not able to find some repository dependencies when their names are not an exact match (e.g: sc-controller [0.4.7-1] relies on "pylibacl". This dependency now is called "python-pylibacl")
- UI
- history dialog: not able to maximize/minimize it on some systems
- wrong tooltips

View File

@@ -454,7 +454,7 @@ class AppImageManager(SoftwareManager):
def install(self, pkg: AppImage, root_password: str, disk_loader: DiskCacheLoader, watcher: ProcessWatcher) -> TransactionResult:
handler = ProcessHandler(watcher)
out_dir = INSTALLATION_PATH + pkg.name.lower()
out_dir = INSTALLATION_PATH + pkg.get_clean_name()
counter = 0
while True:
if os.path.exists(out_dir):
@@ -530,7 +530,7 @@ class AppImageManager(SoftwareManager):
with open('{}/{}'.format(extracted_folder, desktop_entry)) as f:
de_content = f.read()
de_content = RE_DESKTOP_EXEC.sub('Exec={}\n'.format(file_path), de_content)
de_content = RE_DESKTOP_EXEC.sub('Exec="{}"\n'.format(file_path), de_content)
extracted_icon = self._find_icon_file(extracted_folder)
@@ -565,7 +565,7 @@ class AppImageManager(SoftwareManager):
return TransactionResult.fail()
def _gen_desktop_entry_path(self, app: AppImage) -> str:
return '{}/bauh_appimage_{}.desktop'.format(DESKTOP_ENTRIES_PATH, app.name.lower())
return '{}/bauh_appimage_{}.desktop'.format(DESKTOP_ENTRIES_PATH, app.get_clean_name())
def is_enabled(self) -> bool:
return self.enabled

View File

@@ -1,10 +1,13 @@
from typing import List
import re
from typing import List, Optional
from bauh.api.abstract.model import SoftwarePackage, CustomSoftwareAction
from bauh.commons import resource
from bauh.gems.appimage import ROOT_DIR, INSTALLATION_PATH
from bauh.view.util.translation import I18n
RE_MANY_SPACES = re.compile(r'\s+')
CACHED_ATTRS = {'name', 'description', 'version', 'url_download', 'author', 'license', 'source',
'icon_path', 'github', 'categories', 'imported', 'install_dir', 'symlink'}
@@ -120,3 +123,7 @@ class AppImage(SoftwarePackage):
def __eq__(self, other):
if isinstance(other, AppImage):
return self.name == other.name and self.local_file_path == other.local_file_path
def get_clean_name(self) -> Optional[str]:
if self.name:
return RE_MANY_SPACES.sub('-', self.name.lower().strip())

View File

@@ -121,7 +121,7 @@ class SymlinksVerifier(Thread):
@staticmethod
def create_symlink(app: AppImage, file_path: str, logger: logging.Logger, watcher: ProcessWatcher = None):
logger.info("Creating a symlink for '{}'".format(app.name))
possible_names = (app.name.lower(), '{}-appimage'.format(app.name.lower()))
possible_names = (app.get_clean_name(), '{}-appimage'.format(app.get_clean_name()), app.name.lower(), '{}-appimage'.format(app.name.lower()))
if os.path.exists(SYMLINKS_DIR) and not os.path.isdir(SYMLINKS_DIR):
logger.warning("'{}' is not a directory. It will not be possible to create a symlink for '{}'".format(SYMLINKS_DIR, app.name))