mirror of
https://github.com/velopack/velopack.git
synced 2025-10-25 15:19:22 +00:00
We no longer allow packages to be created without an aware exe
This commit is contained in:
@@ -103,15 +103,21 @@ namespace Squirrel.CommandLine.Windows
|
||||
var libDir = Directory.GetDirectories(Path.Combine(pkgPath, "lib"))
|
||||
.ContextualSingle("package", "'lib' folder");
|
||||
|
||||
foreach (var exename in options.mainExes) {
|
||||
var exepath = Path.GetFullPath(Path.Combine(libDir, exename));
|
||||
if (!File.Exists(exepath)) {
|
||||
throw new Exception($"Could not find main exe '{exename}' in package.");
|
||||
}
|
||||
File.WriteAllText(exepath + ".squirrel", "1");
|
||||
}
|
||||
|
||||
var awareExes = SquirrelAwareExecutableDetector.GetAllSquirrelAwareApps(libDir);
|
||||
|
||||
// unless the validation has been disabled, do not allow the creation of packages
|
||||
// without a SquirrelAwareApp inside
|
||||
if (!options.allowUnaware && !awareExes.Any()) {
|
||||
// do not allow the creation of packages without a SquirrelAwareApp inside
|
||||
if (!awareExes.Any()) {
|
||||
throw new ArgumentException(
|
||||
"There are no SquirreAwareApp's in the provided package. Please mark an exe " +
|
||||
"as aware using the assembly manifest, or use the '--allowUnaware' argument " +
|
||||
"to skip this validation and create a package anyway (not recommended).");
|
||||
"as aware using the '-e' argument, or the assembly manifest.");
|
||||
}
|
||||
|
||||
// warning if there are long paths (>200 char) in this package. 260 is max path
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.Versioning;
|
||||
using System.Text.RegularExpressions;
|
||||
@@ -56,15 +57,16 @@ namespace Squirrel.CommandLine.Windows
|
||||
public string icon { get; private set; }
|
||||
public string appIcon { get; private set; }
|
||||
public bool noDelta { get; private set; }
|
||||
public bool allowUnaware { get; private set; }
|
||||
public string msi { get; private set; }
|
||||
public string debugSetupExe { get; private set; }
|
||||
public string[] mainExes => _mainExes.ToArray();
|
||||
|
||||
private List<string> _mainExes = new();
|
||||
|
||||
public ReleasifyOptions()
|
||||
{
|
||||
// hidden arguments
|
||||
Add("b=|baseUrl=", "Provides a base URL to prefix the RELEASES file packages with", v => baseUrl = v, true);
|
||||
Add("allowUnaware", "Allows building packages without a SquirrelAwareApp (disabled by default)", v => allowUnaware = true, true);
|
||||
Add("addSearchPath=", "Add additional search directories when looking for helper exe's such as Setup.exe, Update.exe, etc",
|
||||
HelperExe.AddSearchPath, true);
|
||||
Add("debugSetupExe=", "Uses the Setup.exe at this {PATH} to create the bundle, and then replaces it with the bundle. " +
|
||||
@@ -76,6 +78,7 @@ namespace Squirrel.CommandLine.Windows
|
||||
Add("f=|framework=", "List of required {RUNTIMES} to install during setup\nexample: 'net6,vcredist143'", v => framework = v);
|
||||
Add("s=|splashImage=", "{PATH} to image/gif displayed during installation", v => splashImage = v);
|
||||
Add("i=|icon=", "{PATH} to .ico for Setup.exe and Update.exe", v => icon = v);
|
||||
Add("e=|mainExe=", "{NAME} of one or more SquirrelAware executables", _mainExes.Add);
|
||||
Add("appIcon=", "{PATH} to .ico for 'Apps and Features' list", v => appIcon = v);
|
||||
if (SquirrelRuntimeInfo.IsWindows) {
|
||||
Add("msi=", "Compile a .msi machine-wide deployment tool with the specified {BITNESS}. (either 'x86' or 'x64')", v => msi = v.ToLower());
|
||||
|
||||
Reference in New Issue
Block a user