Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Commit

Permalink
We no longer allow packages to be created without an aware exe
Browse files Browse the repository at this point in the history
  • Loading branch information
caesay committed May 29, 2022
1 parent 16e670f commit 8080c9c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
16 changes: 11 additions & 5 deletions src/Squirrel.CommandLine/Windows/Commands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,21 @@ static void Releasify(ReleasifyOptions options)
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
Expand Down
7 changes: 5 additions & 2 deletions src/Squirrel.CommandLine/Windows/Options.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Runtime.Versioning;
using System.Text.RegularExpressions;
Expand Down Expand Up @@ -56,15 +57,16 @@ internal class ReleasifyOptions : SigningOptions
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. " +
Expand All @@ -76,6 +78,7 @@ public ReleasifyOptions()
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());
Expand Down

0 comments on commit 8080c9c

Please sign in to comment.