Skip to content

Commit

Permalink
feat: properly handle root svg icons to copy to 'scalable' icon direc…
Browse files Browse the repository at this point in the history
…tory; remove .xpm since it's unsupported by 'dart:ui'
  • Loading branch information
tdiam committed Oct 21, 2023
1 parent ea2d873 commit f4ddc01
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions lib/src/features/home/data/appimage_tools_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ class AppimageToolsRepository {
.listSync()
.firstWhere((element) =>
p.basenameWithoutExtension(element.path) == desktopBasename
&& ['.png', '.svg', '.xpm'].contains(p.extension(element.path))
&& ['.png', '.svg'].contains(p.extension(element.path))
);

if (icon is File) {
Expand All @@ -160,11 +160,19 @@ class AppimageToolsRepository {
);
}

var iconData = await decodeImageFromList(icon.readAsBytesSync());
int iconSize = iconData.height;
var iconFilename = "aip_${desktopBasename}_$checksum" + p.extension(icon.path);
String sizeName;
String iconExt = p.extension(icon.path);
if (iconExt == '.png') {
var iconData = await decodeImageFromList(icon.readAsBytesSync());
int iconSize = iconData.height;
sizeName = "${iconSize}x${iconSize}";
} else {
sizeName = "scalable";
}

var iconFilename = "aip_${desktopBasename}_${checksum}${iconExt}";
icon.moveResolvedFile(
localShareDir + "/icons/hicolor/${iconSize}x${iconSize}/apps/${iconFilename}"
localShareDir + "/icons/hicolor/${sizeName}/apps/${iconFilename}"
);
}
} catch (e) {
Expand Down

0 comments on commit f4ddc01

Please sign in to comment.