From e44d14f4d91ea0c834073e028e23f3ab95e57921 Mon Sep 17 00:00:00 2001 From: Ion Miron Date: Tue, 24 Jul 2018 14:32:24 +0300 Subject: [PATCH] Update: Ensure we don't create stub for generated stub executables --- .gitignore | 1 + src/Squirrel/Utility.cs | 9 ++++++++- src/Update/Program.cs | 15 ++++++++------- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index fb65cb075..36ef9ac31 100644 --- a/.gitignore +++ b/.gitignore @@ -37,6 +37,7 @@ local.properties ## Ignore Visual Studio temporary files, build results, and ## files generated by popular Visual Studio add-ons. +.vs # User-specific files *.suo diff --git a/src/Squirrel/Utility.cs b/src/Squirrel/Utility.cs index 5e683d423..34f06fe12 100644 --- a/src/Squirrel/Utility.cs +++ b/src/Squirrel/Utility.cs @@ -74,7 +74,14 @@ public static IEnumerable GetAllFilesRecursively(this DirectoryInfo ro { Contract.Requires(rootPath != null); - return rootPath.EnumerateFiles("*", SearchOption.AllDirectories); + return rootPath.GetAllFilesRecursively("*"); + } + + public static IEnumerable GetAllFilesRecursively(this DirectoryInfo rootPath, string searchPattern) + { + Contract.Requires(rootPath != null); + + return rootPath.EnumerateFiles(searchPattern, SearchOption.AllDirectories); } public static IEnumerable GetAllFilePathsRecursively(string rootPath) diff --git a/src/Update/Program.cs b/src/Update/Program.cs index f87ab691b..10361c527 100644 --- a/src/Update/Program.cs +++ b/src/Update/Program.cs @@ -392,13 +392,14 @@ public void Releasify(string package, string targetDir = null, string packagesDi var rp = new ReleasePackage(file.FullName); rp.CreateReleasePackage(Path.Combine(di.FullName, rp.SuggestedReleaseFileName), packagesDir, contentsPostProcessHook: pkgPath => { - new DirectoryInfo(pkgPath).GetAllFilesRecursively() - .Where(x => x.Name.ToLowerInvariant().EndsWith(".exe")) - .Where(x => !x.Name.ToLowerInvariant().Contains("squirrel.exe")) - .Where(x => Utility.IsFileTopLevelInPackage(x.FullName, pkgPath)) - .Where(x => Utility.ExecutableUsesWin32Subsystem(x.FullName)) - .ForEachAsync(x => createExecutableStubForExe(x.FullName)) - .Wait(); + new DirectoryInfo(pkgPath) + .GetAllFilesRecursively("*.exe") + .Where(x => !x.Name.ToLowerInvariant().Contains("squirrel.exe")) + .Where(x => Utility.IsFileTopLevelInPackage(x.FullName, pkgPath)) + .Where(x => Utility.ExecutableUsesWin32Subsystem(x.FullName)) + .ToList() + .ForEachAsync(x => createExecutableStubForExe(x.FullName)) + .Wait(); if (signingOpts == null) return;