mirror of
https://github.com/velopack/velopack.git
synced 2025-10-25 15:19:22 +00:00
Add linux freedesktop category argument
This commit is contained in:
@@ -88,6 +88,8 @@ public class PackTask : MSBuildAsyncTask
|
||||
|
||||
public string? SignTemplate { get; set; }
|
||||
|
||||
public string? Categories { get; set; }
|
||||
|
||||
protected override async Task<bool> ExecuteAsync()
|
||||
{
|
||||
//System.Diagnostics.Debugger.Launch();
|
||||
|
||||
@@ -94,6 +94,7 @@
|
||||
SignSkipDll="$(VelopackSignSkipDll)"
|
||||
SignParallel="$(VelopackSignParallel)"
|
||||
SignTemplate="$(VelopackSignTemplate)"
|
||||
Categories="$(VelopackCategories)"
|
||||
/>
|
||||
</Target>
|
||||
|
||||
|
||||
@@ -32,6 +32,9 @@ public class LinuxPackCommandRunner : PackageBuilder<LinuxPackOptions>
|
||||
var iconFilename = Options.PackId + Path.GetExtension(icon);
|
||||
File.Copy(icon, Path.Combine(dir.FullName, iconFilename), true);
|
||||
|
||||
var categories = String.IsNullOrWhiteSpace(Options.Categories) ? "" :
|
||||
$"Categories={Options.Categories.TrimEnd(';')};";
|
||||
|
||||
File.WriteAllText(appRunPath, $$"""
|
||||
#!/bin/sh
|
||||
|
||||
@@ -66,7 +69,7 @@ Comment={Options.PackTitle ?? Options.PackId} {Options.PackVersion}
|
||||
Icon={Options.PackId}
|
||||
Exec={mainExeName}
|
||||
StartupWMClass={Options.PackId}
|
||||
Categories=Development;
|
||||
{categories}
|
||||
""");
|
||||
|
||||
// copy existing app files
|
||||
|
||||
@@ -35,4 +35,6 @@ public class LinuxPackOptions : IPackOptions
|
||||
public bool NoPortable { get; set; }
|
||||
|
||||
public bool NoInst { get; set; }
|
||||
|
||||
public string Categories { get; set; }
|
||||
}
|
||||
|
||||
@@ -4,12 +4,18 @@ public class LinuxPackCommand : PackCommand
|
||||
{
|
||||
public bool PackIsAppDir { get; private set; }
|
||||
|
||||
public string Categories { get; private set; }
|
||||
|
||||
public LinuxPackCommand()
|
||||
: base("pack", "Create's a Linux .AppImage bundle from a folder containing application files.")
|
||||
{
|
||||
this.RemoveOption(NoPortableOption);
|
||||
this.RemoveOption(NoInstOption);
|
||||
|
||||
var categories = AddOption<string>((v) => Categories = v, "--categories")
|
||||
.SetDescription("Categories from the freedesktop.org Desktop Menu spec")
|
||||
.SetArgumentHelpName("NAMES");
|
||||
|
||||
var appDir = AddOption<DirectoryInfo>((v) => {
|
||||
var t = v.ToFullNameOrNull();
|
||||
if (t != null) {
|
||||
@@ -24,5 +30,6 @@ public class LinuxPackCommand : PackCommand
|
||||
this.AtLeastOneRequired(PackDirectoryOption, appDir);
|
||||
this.AreMutuallyExclusive(PackDirectoryOption, appDir);
|
||||
this.AreMutuallyExclusive(IconOption, appDir);
|
||||
this.AreMutuallyExclusive(categories, appDir);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user