Skip to content

Commit

Permalink
ci: Copy files respecting nested folder + autocad slug change
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanRynne committed May 24, 2024
1 parent 2cc0ecc commit 3e7758c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Build/Consts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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") })
};
}

Expand Down
27 changes: 16 additions & 11 deletions Build/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,27 +126,32 @@ IEnumerable<string> 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);
}
}

var outputPath = Path.Combine(outputDir, $"{x.HostAppSlug}.zip");
File.Delete(outputPath);
Console.WriteLine($"Zipping: '{slugDir}' to '{outputPath}'");
ZipFile.CreateFromDirectory(slugDir, outputPath);
Directory.Delete(slugDir, true);
// Directory.Delete(slugDir, true);
}
);

Expand Down

0 comments on commit 3e7758c

Please sign in to comment.