[appimage] fix -> manual file installation: crashing the application icon is not on the extracted folder root path

This commit is contained in:
Vinicius Moreira
2020-08-11 14:01:04 -03:00
parent 4de2eb317e
commit 244d48f18a
2 changed files with 8 additions and 6 deletions

View File

@@ -21,6 +21,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Creating the exports path **~/.local/share/flatpak/exports/share** (if it does not exist) and adding it to install/upgrade/downgrade/remove commands path to prevent warning messages.
### Fixes
- AppImage
- manual file installation:
- crashing the application icon is not on the extracted folder root path [#132](https://github.com/vinifmor/bauh/issues/132)
- Arch
- not able to upgrade a package that explicitly defines a conflict with itself (e.g: grub)
- Downloading some AUR packages sources twice when multi-threaded download is enabled

View File

@@ -419,10 +419,9 @@ class AppImageManager(SoftwareManager):
return f
def _find_icon_file(self, folder: str) -> str:
for r, d, files in os.walk(folder):
for f in files:
if RE_ICON_ENDS_WITH.match(f):
return f
for f in glob.glob(folder + ('/**' if not folder.endswith('/') else '**'), recursive=True):
if RE_ICON_ENDS_WITH.match(f):
return f
def install(self, pkg: AppImage, root_password: str, disk_loader: DiskCacheLoader, watcher: ProcessWatcher) -> TransactionResult:
handler = ProcessHandler(watcher)
@@ -508,8 +507,8 @@ class AppImageManager(SoftwareManager):
extracted_icon = self._find_icon_file(extracted_folder)
if extracted_icon:
icon_path = out_dir + '/logo.' + extracted_icon.split('.')[-1]
shutil.copy('{}/{}'.format(extracted_folder, extracted_icon), icon_path)
icon_path = out_dir + '/logo.' + extracted_icon.split('/')[-1].split('.')[-1]
shutil.copy(extracted_icon, icon_path)
de_content = RE_DESKTOP_ICON.sub('Icon={}\n'.format(icon_path), de_content)
pkg.icon_path = icon_path