diff --git a/artwork/DefaultApp.icns b/artwork/DefaultApp.icns new file mode 100644 index 00000000..452a89a6 Binary files /dev/null and b/artwork/DefaultApp.icns differ diff --git a/artwork/DefaultApp_64.png b/artwork/DefaultApp_64.png new file mode 100644 index 00000000..1c766dc3 Binary files /dev/null and b/artwork/DefaultApp_64.png differ diff --git a/samples/AvaloniaCrossPlat/Velopack.icns b/samples/AvaloniaCrossPlat/Velopack.icns deleted file mode 100644 index 11d77901..00000000 Binary files a/samples/AvaloniaCrossPlat/Velopack.icns and /dev/null differ diff --git a/samples/AvaloniaCrossPlat/Velopack.png b/samples/AvaloniaCrossPlat/Velopack.png deleted file mode 100644 index c278b606..00000000 Binary files a/samples/AvaloniaCrossPlat/Velopack.png and /dev/null differ diff --git a/samples/AvaloniaCrossPlat/build-linux.sh b/samples/AvaloniaCrossPlat/build-linux.sh index c4082a2d..b3ec51e2 100644 --- a/samples/AvaloniaCrossPlat/build-linux.sh +++ b/samples/AvaloniaCrossPlat/build-linux.sh @@ -13,7 +13,6 @@ fi BUILD_VERSION="$1" RELEASE_DIR="$SCRIPT_DIR/releases" PUBLISH_DIR="$SCRIPT_DIR/publish" -ICON_PATH="$SCRIPT_DIR/Velopack.png" echo "" echo "Compiling AvaloniaCrossPlat with dotnet..." @@ -21,4 +20,4 @@ dotnet publish -c Release --self-contained -r linux-x64 -o "$PUBLISH_DIR" echo "" echo "Building Velopack Release v$BUILD_VERSION" -vpk pack -u AvaloniaCrossPlat -v $BUILD_VERSION -o "$RELEASE_DIR" -p "$PUBLISH_DIR" -i "$ICON_PATH" \ No newline at end of file +vpk pack -u AvaloniaCrossPlat -v $BUILD_VERSION -o "$RELEASE_DIR" -p "$PUBLISH_DIR" \ No newline at end of file diff --git a/samples/AvaloniaCrossPlat/build-osx.sh b/samples/AvaloniaCrossPlat/build-osx.sh index 5a7008d2..75ae3892 100644 --- a/samples/AvaloniaCrossPlat/build-osx.sh +++ b/samples/AvaloniaCrossPlat/build-osx.sh @@ -13,7 +13,6 @@ fi BUILD_VERSION="$1" RELEASE_DIR="$SCRIPT_DIR/releases" PUBLISH_DIR="$SCRIPT_DIR/publish" -ICON_PATH="$SCRIPT_DIR/Velopack.icns" echo "" echo "Compiling AvaloniaCrossPlat with dotnet..." @@ -21,4 +20,4 @@ dotnet publish -c Release --self-contained -r osx-x64 -o "$PUBLISH_DIR" echo "" echo "Building Velopack Release v$BUILD_VERSION" -vpk pack -u AvaloniaCrossPlat -v $BUILD_VERSION -o "$RELEASE_DIR" -p "$PUBLISH_DIR" -i "$ICON_PATH" \ No newline at end of file +vpk pack -u AvaloniaCrossPlat -v $BUILD_VERSION -o "$RELEASE_DIR" -p "$PUBLISH_DIR" \ No newline at end of file diff --git a/src/Velopack.Packaging.Unix/Commands/LinuxPackCommandRunner.cs b/src/Velopack.Packaging.Unix/Commands/LinuxPackCommandRunner.cs index 3ca712f5..a8d5bf9e 100644 --- a/src/Velopack.Packaging.Unix/Commands/LinuxPackCommandRunner.cs +++ b/src/Velopack.Packaging.Unix/Commands/LinuxPackCommandRunner.cs @@ -54,7 +54,8 @@ Categories=Development; // copy existing app files CopyFiles(new DirectoryInfo(packDir), bin, progress, true); // app icon - File.Copy(Options.Icon, Path.Combine(dir.FullName, Options.PackId + Path.GetExtension(Options.Icon)), true); + var icon = Options.Icon ?? HelperFile.GetDefaultAppIcon(); + File.Copy(icon, Path.Combine(dir.FullName, Options.PackId + Path.GetExtension(icon)), true); } // velopack required files diff --git a/src/Velopack.Packaging.Unix/Commands/OsxBundleCommandRunner.cs b/src/Velopack.Packaging.Unix/Commands/OsxBundleCommandRunner.cs index b6170419..900c53f2 100644 --- a/src/Velopack.Packaging.Unix/Commands/OsxBundleCommandRunner.cs +++ b/src/Velopack.Packaging.Unix/Commands/OsxBundleCommandRunner.cs @@ -25,7 +25,7 @@ public class OsxBundleCommandRunner : ICommand public string Bundle(OsxBundleOptions options) { - var icon = options.Icon; + var icon = options.Icon ?? HelperFile.GetDefaultAppIcon(); var packId = options.PackId; var packDirectory = options.PackDirectory; var packVersion = options.PackVersion; diff --git a/src/Velopack.Packaging/Abstractions/IPackOptions.cs b/src/Velopack.Packaging/Abstractions/IPackOptions.cs index 2c9b49cb..e7f112d8 100644 --- a/src/Velopack.Packaging/Abstractions/IPackOptions.cs +++ b/src/Velopack.Packaging/Abstractions/IPackOptions.cs @@ -6,4 +6,5 @@ public interface IPackOptions : INugetPackCommand, IPlatformOptions DeltaMode DeltaMode { get; } string EntryExecutableName { get; } bool IncludePdb { get; } + string Icon { get; } } diff --git a/src/Velopack.Packaging/HelperFile.cs b/src/Velopack.Packaging/HelperFile.cs index 55256c7a..35999c64 100644 --- a/src/Velopack.Packaging/HelperFile.cs +++ b/src/Velopack.Packaging/HelperFile.cs @@ -54,6 +54,21 @@ public static class HelperFile [SupportedOSPlatform("windows")] public static string RceditPath => FindHelperFile("rcedit.exe"); + public static string GetDefaultAppIcon(RuntimeOs? os = null) + { + var _os = os ?? VelopackRuntimeInfo.SystemOs; + switch (_os) { + case RuntimeOs.Windows: + return null; + case RuntimeOs.Linux: + return FindHelperFile("DefaultApp_64.png"); + case RuntimeOs.OSX: + return FindHelperFile("DefaultApp.icns"); + default: + throw new PlatformNotSupportedException("Default Icon is not available for this platform."); + } + } + private static List _searchPaths = new List(); static HelperFile() @@ -61,6 +76,7 @@ public static class HelperFile #if DEBUG AddSearchPath(AppContext.BaseDirectory, "..", "..", "..", "src", "Rust", "target", "debug"); AddSearchPath(AppContext.BaseDirectory, "..", "..", "..", "vendor"); + AddSearchPath(AppContext.BaseDirectory, "..", "..", "..", "artwork"); #else AddSearchPath(AppContext.BaseDirectory, "..", "..", "..", "vendor"); #endif diff --git a/src/Velopack.Vpk/Commands/LinuxPackCommand.cs b/src/Velopack.Vpk/Commands/LinuxPackCommand.cs index 2ae5e2cf..a96621a9 100644 --- a/src/Velopack.Vpk/Commands/LinuxPackCommand.cs +++ b/src/Velopack.Vpk/Commands/LinuxPackCommand.cs @@ -92,9 +92,8 @@ public class LinuxPackCommand : PlatformCommand .SetArgumentHelpName("DIR") .MustNotBeEmpty(); - this.AreMutuallyExclusive(packDir, appDir); this.AtLeastOneRequired(packDir, appDir); + this.AreMutuallyExclusive(packDir, appDir); this.AreMutuallyExclusive(icon, appDir); - this.AtLeastOneRequired(icon, appDir); } } diff --git a/src/Velopack.Vpk/Commands/OsxBundleCommand.cs b/src/Velopack.Vpk/Commands/OsxBundleCommand.cs index e8b161b5..bac161d2 100644 --- a/src/Velopack.Vpk/Commands/OsxBundleCommand.cs +++ b/src/Velopack.Vpk/Commands/OsxBundleCommand.cs @@ -62,7 +62,6 @@ public class OsxBundleCommand : PlatformCommand .SetDescription("Path to the .icns file for this bundle.") .SetArgumentHelpName("PATH") .MustExist() - .SetRequired() .RequiresExtension(".icns"); var bundleId = AddOption((v) => BundleId = v, "--bundleId") diff --git a/src/Velopack.Vpk/Velopack.Vpk.csproj b/src/Velopack.Vpk/Velopack.Vpk.csproj index 7c28a731..f5906bb1 100644 --- a/src/Velopack.Vpk/Velopack.Vpk.csproj +++ b/src/Velopack.Vpk/Velopack.Vpk.csproj @@ -34,6 +34,8 @@ + + diff --git a/test/Velopack.Packaging.Tests/TestApp.cs b/test/Velopack.Packaging.Tests/TestApp.cs index f6795b07..a019b8f6 100644 --- a/test/Velopack.Packaging.Tests/TestApp.cs +++ b/test/Velopack.Packaging.Tests/TestApp.cs @@ -51,7 +51,6 @@ public static class TestApp EntryExecutableName = "TestApp", ReleaseDir = new DirectoryInfo(releaseDir), PackId = id, - Icon = Path.Combine(PathHelper.GetProjectDir(), "samples", "AvaloniaCrossPlat", "Velopack.icns"), TargetRuntime = RID.Parse(VelopackRuntimeInfo.SystemOs.GetOsShortName()), PackVersion = version, PackDirectory = Path.Combine(projDir, "publish"), @@ -65,7 +64,6 @@ public static class TestApp EntryExecutableName = "TestApp", ReleaseDir = new DirectoryInfo(releaseDir), PackId = id, - Icon = Path.Combine(PathHelper.GetProjectDir(), "samples", "AvaloniaCrossPlat", "Velopack.png"), TargetRuntime = RID.Parse(VelopackRuntimeInfo.SystemOs.GetOsShortName()), PackVersion = version, PackDirectory = Path.Combine(projDir, "publish"),