From 1519bb633981a24107c1a41c970edc59eb9daf7c Mon Sep 17 00:00:00 2001 From: Cibbi <12004047+Cibbi@users.noreply.github.com> Date: Tue, 31 Oct 2023 18:51:33 +0100 Subject: [PATCH 1/3] Create output directory if missing --- VRLabs.VRCTools.Packaging/Packager.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/VRLabs.VRCTools.Packaging/Packager.cs b/VRLabs.VRCTools.Packaging/Packager.cs index d2ac034..f7b3671 100644 --- a/VRLabs.VRCTools.Packaging/Packager.cs +++ b/VRLabs.VRCTools.Packaging/Packager.cs @@ -29,6 +29,8 @@ public static async Task CreatePackage(string workingDirectory, string out if(Directory.Exists(tempPath)) DeleteDirectory(tempPath); Directory.CreateDirectory(tempPath); + if(!Directory.Exists(outputDirectory)) DeleteDirectory(outputDirectory); + string? sha256String = null; data["zipSHA256"] = null; From f546041bc4fbc722bc1460f0cbb628597a2cbe68 Mon Sep 17 00:00:00 2001 From: Cibbi <12004047+Cibbi@users.noreply.github.com> Date: Tue, 31 Oct 2023 18:52:22 +0100 Subject: [PATCH 2/3] Return 1 if any exception happens --- VRLabs.VRCTools.Packaging.Console/Program.cs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/VRLabs.VRCTools.Packaging.Console/Program.cs b/VRLabs.VRCTools.Packaging.Console/Program.cs index 66a913d..1c711f9 100644 --- a/VRLabs.VRCTools.Packaging.Console/Program.cs +++ b/VRLabs.VRCTools.Packaging.Console/Program.cs @@ -29,11 +29,19 @@ command.SetHandler(async (source, output, releaseUrl, unityReleaseUrl, version, noVcc, noUnity, action) => { - Environment.SetEnvironmentVariable("RUNNING_ON_GITHUB_ACTIONS", action ? "true" : "false"); - var result = await Packager.CreatePackage(source, output, releaseUrl, unityReleaseUrl, version, noVcc, noUnity); - if (!result) + try { - Log.Error("Failed to create package"); + Environment.SetEnvironmentVariable("RUNNING_ON_GITHUB_ACTIONS", action ? "true" : "false"); + var result = await Packager.CreatePackage(source, output, releaseUrl, unityReleaseUrl, version, noVcc, noUnity); + if (!result) + { + Log.Error("Failed to create package"); + Environment.Exit(1); + } + } + catch (Exception e) + { + Log.Error(e, "Failed to create package"); Environment.Exit(1); } From 54c3fe004a286a5db30262540eb4f2b5ef5cfa57 Mon Sep 17 00:00:00 2001 From: Cibbi <12004047+Cibbi@users.noreply.github.com> Date: Tue, 31 Oct 2023 19:12:58 +0100 Subject: [PATCH 3/3] i'm dumb --- VRLabs.VRCTools.Packaging/Packager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VRLabs.VRCTools.Packaging/Packager.cs b/VRLabs.VRCTools.Packaging/Packager.cs index f7b3671..0093c97 100644 --- a/VRLabs.VRCTools.Packaging/Packager.cs +++ b/VRLabs.VRCTools.Packaging/Packager.cs @@ -29,7 +29,7 @@ public static async Task CreatePackage(string workingDirectory, string out if(Directory.Exists(tempPath)) DeleteDirectory(tempPath); Directory.CreateDirectory(tempPath); - if(!Directory.Exists(outputDirectory)) DeleteDirectory(outputDirectory); + if(!Directory.Exists(outputDirectory)) Directory.CreateDirectory(outputDirectory); string? sha256String = null; data["zipSHA256"] = null;