From 8b0d1b4a8c37f2ee1cb98b7c552ae9007a238d7b Mon Sep 17 00:00:00 2001 From: Crawcik Date: Wed, 7 Sep 2022 17:43:11 +0200 Subject: [PATCH] Editor compression fix on unix --- .../Flax.Build/Deploy/Deployment.Editor.cs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/Source/Tools/Flax.Build/Deploy/Deployment.Editor.cs b/Source/Tools/Flax.Build/Deploy/Deployment.Editor.cs index ad94da918..6a5e2fb04 100644 --- a/Source/Tools/Flax.Build/Deploy/Deployment.Editor.cs +++ b/Source/Tools/Flax.Build/Deploy/Deployment.Editor.cs @@ -7,6 +7,7 @@ using System.Collections.Generic; using System.Diagnostics; using System.IO; using Flax.Build; +using Flax.Build.Platforms; namespace Flax.Deploy { @@ -129,18 +130,18 @@ namespace Flax.Deploy Log.Info(string.Empty); Log.Info("Compressing editor files..."); string editorPackageZipPath; - if (Platform.BuildTargetPlatform == TargetPlatform.Linux) + var unix = Platform.BuildTargetPlatform == TargetPlatform.Linux || Platform.BuildTargetPlatform == TargetPlatform.Mac; + if (unix) { - // Use system tool (preserves executable file attributes and link files) - editorPackageZipPath = Path.Combine(Deployer.PackageOutputPath, "FlaxEditorLinux.zip"); - Utilities.FileDelete(editorPackageZipPath); - Utilities.Run("zip", "Editor.zip -r .", null, OutputPath, Utilities.RunOptions.ThrowExceptionOnError); - File.Move(Path.Combine(OutputPath, "Editor.zip"), editorPackageZipPath); + var zipEofPath = UnixPlatform.Which("zip"); + unix = File.Exists(zipEofPath); + if (!unix) + Log.Verbose("Using .NET compressing"); } - else if (Platform.BuildTargetPlatform == TargetPlatform.Mac) + if (unix) { // Use system tool (preserves executable file attributes and link files) - editorPackageZipPath = Path.Combine(Deployer.PackageOutputPath, "FlaxEditorMac.zip"); + editorPackageZipPath = Path.Combine(Deployer.PackageOutputPath, $"FlaxEditor{Enum.GetName(typeof(TargetPlatform), Platform.BuildTargetPlatform)}.zip"); Utilities.FileDelete(editorPackageZipPath); Utilities.Run("zip", "Editor.zip -r .", null, OutputPath, Utilities.RunOptions.ThrowExceptionOnError); File.Move(Path.Combine(OutputPath, "Editor.zip"), editorPackageZipPath);