From 3e7758c38dfff59a31452607d75cb29ae9ec9acd Mon Sep 17 00:00:00 2001 From: Alan Rynne Date: Fri, 24 May 2024 19:21:31 +0200 Subject: [PATCH] ci: Copy files respecting nested folder + autocad slug change --- Build/Consts.cs | 2 +- Build/Program.cs | 27 ++++++++++++++++----------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/Build/Consts.cs b/Build/Consts.cs index d18e26d5ee..d8921e234f 100644 --- a/Build/Consts.cs +++ b/Build/Consts.cs @@ -14,7 +14,7 @@ public static class Consts ), new("rhino", new InstallerAsset[] { new("DUI3-DX/Connectors/Rhino/Speckle.Connectors.Rhino7", "net48") }), new("revit", new InstallerAsset[] { new("DUI3-DX/Connectors/Revit/Speckle.Connectors.Revit2023", "net48") }), - new("acad", new InstallerAsset[] { new("DUI3-DX/Connectors/Autocad/Speckle.Connectors.Autocad2023", "net48") }) + new("autocad", new InstallerAsset[] { new("DUI3-DX/Connectors/Autocad/Speckle.Connectors.Autocad2023", "net48") }) }; } diff --git a/Build/Program.cs b/Build/Program.cs index 1e5756662b..df88496f33 100644 --- a/Build/Program.cs +++ b/Build/Program.cs @@ -126,19 +126,24 @@ IEnumerable GetFiles(string d) foreach (var asset in x.Projects) { var fullPath = Path.Combine(".", asset.ProjectPath, "bin", "Release", asset.TargetName); - if (Directory.Exists(fullPath)) + if (!Directory.Exists(fullPath)) { - var assetName = Path.GetFileName(asset.ProjectPath); - Directory.CreateDirectory(Path.Combine(slugDir, assetName)); - foreach (var file in Directory.EnumerateFiles(fullPath, "*", SearchOption.AllDirectories)) - { - Console.WriteLine(file); - File.Copy(file, Path.Combine(slugDir, assetName, Path.GetFileName(file)), true); - } + throw new InvalidOperationException("Could not find: " + fullPath); } - else + + var assetName = Path.GetFileName(asset.ProjectPath); + var connectorDir = Path.Combine(slugDir, assetName); + + Directory.CreateDirectory(connectorDir); + foreach (var directory in Directory.EnumerateDirectories(fullPath, "*", SearchOption.AllDirectories)) { - throw new InvalidOperationException("Could not find: " + fullPath); + Directory.CreateDirectory(directory.Replace(fullPath, connectorDir)); + } + + foreach (var file in Directory.EnumerateFiles(fullPath, "*", SearchOption.AllDirectories)) + { + Console.WriteLine(file); + File.Copy(file, file.Replace(fullPath, connectorDir), true); } } @@ -146,7 +151,7 @@ IEnumerable GetFiles(string d) File.Delete(outputPath); Console.WriteLine($"Zipping: '{slugDir}' to '{outputPath}'"); ZipFile.CreateFromDirectory(slugDir, outputPath); - Directory.Delete(slugDir, true); + // Directory.Delete(slugDir, true); } );