diff --git a/PupNet/PackageBuilder.cs b/PupNet/PackageBuilder.cs index 666e034..d776a50 100644 --- a/PupNet/PackageBuilder.cs +++ b/PupNet/PackageBuilder.cs @@ -62,13 +62,13 @@ public PackageBuilder(ConfigurationReader conf, PackageKind kind) BuildRoot = Path.Combine(Root, AppRootName); Operations = new(Root); - IconPaths = GetShareIconPaths(Configuration.IconFiles); + IconPaths = GetShareIconPaths(kind, Configuration.IconFiles); if (IconPaths.Count == 0) { // Fallback to embedded icons on Linux // Should always empty on non-linux systems - IconPaths = GetShareIconPaths(Configuration.DesktopTerminal ? DefaultTerminalIcons : DefaultGuiIcons); + IconPaths = GetShareIconPaths(kind, Configuration.DesktopTerminal ? DefaultTerminalIcons : DefaultGuiIcons); } // Should be ico on Windows, or SVG or PNG on linux @@ -746,6 +746,13 @@ private static int GetStandardPngSize(string filename) // Or biggest PNG int size = GetStandardPngSize(item); + + //Flatpak max resolution is 512 + if (kind == PackageKind.Flatpak) + { + if(size > 512) + continue; + } if (size > max) { @@ -759,7 +766,7 @@ private static int GetStandardPngSize(string filename) return rslt; } - private string? MapSourceIconToSharePath(string sourcePath) + private string? MapSourceIconToSharePath(PackageKind kind, string sourcePath) { if (BuildShareIcons != null) { @@ -774,6 +781,8 @@ private static int GetStandardPngSize(string filename) if (size > 0) { + if (kind == PackageKind.Flatpak && size > 512) + return null; return Path.Combine(BuildShareIcons, "hicolor", $"{size}x{size}", "apps", Configuration.AppId) + ".png"; } } @@ -781,7 +790,7 @@ private static int GetStandardPngSize(string filename) return null; } - private IReadOnlyDictionary GetShareIconPaths(IReadOnlyCollection sources) + private IReadOnlyDictionary GetShareIconPaths(PackageKind kind,IReadOnlyCollection sources) { // Empty on windows var dict = new Dictionary(); @@ -790,7 +799,7 @@ private IReadOnlyDictionary GetShareIconPaths(IReadOnlyCollectio { foreach (var item in sources) { - var dest = MapSourceIconToSharePath(item); + var dest = MapSourceIconToSharePath(kind, item); if (dest != null) {