From 85f5f8f4e984785719a10d6fc599abc95b412b5d Mon Sep 17 00:00:00 2001 From: Michael Cuddy Date: Fri, 5 Sep 2025 23:12:09 -0700 Subject: [PATCH 1/4] refactor to startInfo.ArgumentList --- Editor/Distros/ZipDistro.cs | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/Editor/Distros/ZipDistro.cs b/Editor/Distros/ZipDistro.cs index 2a7e7d8..a3f47a8 100644 --- a/Editor/Distros/ZipDistro.cs +++ b/Editor/Distros/ZipDistro.cs @@ -280,21 +280,23 @@ protected async Task Zip(BuildPath buildPath, TaskToken task) } // Run 7za command to create ZIP file - var excludes = ""; + + var startInfo = new System.Diagnostics.ProcessStartInfo(); + var argv = startInfo.ArgumentList; + var inputName = Path.GetFileName(basePath); + + argv.Add("a"); + argv.Add(outputPath); + argv.Add(inputName); + argv.Add(((int)compression).ToString()); + foreach (var pattern in ZipIgnore) { - excludes += @" -xr\!'" + pattern + "'"; + argv.Add(@" -xr!" + pattern); } - var inputName = Path.GetFileName(basePath); - var args = string.Format( - "a '{0}' '{1}' -mx{2} {3}", - outputPath, inputName, (int)compression, excludes - ); - - var startInfo = new System.Diagnostics.ProcessStartInfo(); startInfo.FileName = sevenZPath; - startInfo.Arguments = args; startInfo.WorkingDirectory = Path.GetDirectoryName(basePath); + startInfo.UseShellExecute = false; task.Report(0, description: $"Archiving {inputName}"); @@ -313,11 +315,14 @@ protected async Task RenameRoot(string archivePath, string oldName, string newNa throw new Exception("ZipDistro: Path to archive does not exist: " + archivePath); } - var args = string.Format( - "rn '{0}' '{1}' '{2}'", - archivePath, oldName, newName - ); - await Execute(new ExecutionArgs(Get7ZipPath(), args), task); + var startInfo = new System.Diagnostics.ProcessStartInfo(Get7ZipPath()); + var argv = startInfo.ArgumentList; + argv.Add("rn"); + argv.Add(archivePath); + argv.Add(oldName); + argv.Add(newName); + + await Execute(new ExecutionArgs(startInfo), task); } protected override async Task RunDistribute(IEnumerable buildPaths, TaskToken task) From 41d5b1c4844a6baa64f76b65019b99f4800d8336 Mon Sep 17 00:00:00 2001 From: Michael Cuddy Date: Fri, 5 Sep 2025 23:32:19 -0700 Subject: [PATCH 2/4] fix compression argument --- Editor/Distros/ZipDistro.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Editor/Distros/ZipDistro.cs b/Editor/Distros/ZipDistro.cs index a3f47a8..5dd8cc6 100644 --- a/Editor/Distros/ZipDistro.cs +++ b/Editor/Distros/ZipDistro.cs @@ -7,6 +7,7 @@ using System.Collections; using System.Collections.Generic; using System.IO; +using System.Linq; using System.Text.RegularExpressions; using System.Threading.Tasks; using UnityEditor; @@ -288,17 +289,18 @@ protected async Task Zip(BuildPath buildPath, TaskToken task) argv.Add("a"); argv.Add(outputPath); argv.Add(inputName); - argv.Add(((int)compression).ToString()); + argv.Add($"-mx{(int)compression}"); foreach (var pattern in ZipIgnore) { - argv.Add(@" -xr!" + pattern); + argv.Add(@"-xr!" + pattern); } startInfo.FileName = sevenZPath; startInfo.WorkingDirectory = Path.GetDirectoryName(basePath); startInfo.UseShellExecute = false; - task.Report(0, description: $"Archiving {inputName}"); + var argvStr = String.Join("> <", argv.ToArray()); + task.Report(0, description: $"Archiving {inputName}: <{argvStr}>"); await Execute(new ExecutionArgs() { startInfo = startInfo }, task); From 580f91b048a64b58a3fbdd041a1b07b87ef1c196 Mon Sep 17 00:00:00 2001 From: Michael Cuddy Date: Fri, 5 Sep 2025 23:35:18 -0700 Subject: [PATCH 3/4] remove extra imports --- Editor/Distros/ZipDistro.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Editor/Distros/ZipDistro.cs b/Editor/Distros/ZipDistro.cs index 5dd8cc6..f7c320a 100644 --- a/Editor/Distros/ZipDistro.cs +++ b/Editor/Distros/ZipDistro.cs @@ -4,10 +4,8 @@ // using System; -using System.Collections; using System.Collections.Generic; using System.IO; -using System.Linq; using System.Text.RegularExpressions; using System.Threading.Tasks; using UnityEditor; @@ -299,7 +297,7 @@ protected async Task Zip(BuildPath buildPath, TaskToken task) startInfo.WorkingDirectory = Path.GetDirectoryName(basePath); startInfo.UseShellExecute = false; - var argvStr = String.Join("> <", argv.ToArray()); + var argvStr = String.Join("> <", argv); task.Report(0, description: $"Archiving {inputName}: <{argvStr}>"); await Execute(new ExecutionArgs() { startInfo = startInfo }, task); From 04e7bb73078899c171441e1d486adeb17a0a477f Mon Sep 17 00:00:00 2001 From: Michael Cuddy Date: Sat, 6 Sep 2025 11:10:51 -0700 Subject: [PATCH 4/4] use ArgumentList for ItchDistro exec --- Editor/Distros/ItchDistro.cs | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/Editor/Distros/ItchDistro.cs b/Editor/Distros/ItchDistro.cs index 40ae5ea..6c965d4 100644 --- a/Editor/Distros/ItchDistro.cs +++ b/Editor/Distros/ItchDistro.cs @@ -106,12 +106,23 @@ async Task Distribute(BuildPath buildPath, TaskToken task) } } - var args = string.Format( - "push '{0}' '{1}:{2}' --userversion '{3}' --ignore='*.DS_Store' --ignore='build.json'", - path, project, channel, Application.version - ); - - await Execute(new ExecutionArgs(butlerPath, args), task); + var startInfo = new System.Diagnostics.ProcessStartInfo(); + var argv = startInfo.ArgumentList; + + argv.Add("push"); + argv.Add(path); + argv.Add($"{project}:{channel}"); + argv.Add($"--userversion"); argv.Add(Application.version); + argv.Add("--ignore"); argv.Add("*.DS_Store"); + argv.Add("--ignore"); argv.Add("build.json"); + + startInfo.FileName = butlerPath; + startInfo.UseShellExecute = false; + + var argvStr = String.Join("> <", argv); + task.Report(0, description: $"Executing {butlerPath}: <{argvStr}>"); + + await Execute(new ExecutionArgs() { startInfo = startInfo }, task); } }