mirror of
https://github.com/velopack/velopack.git
synced 2025-10-25 15:19:22 +00:00
Make icon an optional parameter on linux/osx
This commit is contained in:
BIN
artwork/DefaultApp.icns
Normal file
BIN
artwork/DefaultApp.icns
Normal file
Binary file not shown.
BIN
artwork/DefaultApp_64.png
Normal file
BIN
artwork/DefaultApp_64.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 3.4 KiB |
@@ -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"
|
||||
vpk pack -u AvaloniaCrossPlat -v $BUILD_VERSION -o "$RELEASE_DIR" -p "$PUBLISH_DIR"
|
||||
@@ -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"
|
||||
vpk pack -u AvaloniaCrossPlat -v $BUILD_VERSION -o "$RELEASE_DIR" -p "$PUBLISH_DIR"
|
||||
@@ -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
|
||||
|
||||
@@ -25,7 +25,7 @@ public class OsxBundleCommandRunner : ICommand<OsxBundleOptions>
|
||||
|
||||
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;
|
||||
|
||||
@@ -6,4 +6,5 @@ public interface IPackOptions : INugetPackCommand, IPlatformOptions
|
||||
DeltaMode DeltaMode { get; }
|
||||
string EntryExecutableName { get; }
|
||||
bool IncludePdb { get; }
|
||||
string Icon { get; }
|
||||
}
|
||||
|
||||
@@ -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<string> _searchPaths = new List<string>();
|
||||
|
||||
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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<string>((v) => BundleId = v, "--bundleId")
|
||||
|
||||
@@ -34,6 +34,8 @@
|
||||
<None Include="..\..\vendor\zstd.exe" Pack="true" PackagePath="vendor" />
|
||||
<None Include="..\..\vendor\signtool.exe" Pack="true" PackagePath="vendor" />
|
||||
<None Include="..\..\Velopack.entitlements" Pack="true" PackagePath="vendor" />
|
||||
<None Include="..\..\artwork\DefaultApp.icns" Pack="true" PackagePath="vendor" />
|
||||
<None Include="..\..\artwork\DefaultApp_64.png" Pack="true" PackagePath="vendor" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -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"),
|
||||
|
||||
Reference in New Issue
Block a user