|
17 | 17 | using System.Reflection; |
18 | 18 | using System.Text.RegularExpressions; |
19 | 19 | using static Dynamo.Models.DynamoModel; |
| 20 | +using DateTime = System.DateTime; |
20 | 21 |
|
21 | 22 | namespace DADynamoApp |
22 | 23 | { |
@@ -237,11 +238,17 @@ public void HandleDesignAutomationReadyEvent(object sender, DesignAutomationRead |
237 | 238 | } |
238 | 239 |
|
239 | 240 | // Ensure we have a pre-built graph output folder. |
| 241 | + var graphOutputFolder = Path.Combine(WorkItemFolder, "output"); |
240 | 242 | try |
241 | 243 | { |
242 | | - var graphOutputFolder = "output"; |
| 244 | + //The output folder is basically a feature that we provide to DAAS_DA users. |
| 245 | + //It offers an out of the box place where graphs can produce data / content(ex.images, xml reports etc). |
| 246 | + //If creation of the folder fails, then most likely the graph execution will have nodes that fail and will report those nodes back to the user. ALso the output.zip file will not be sent back to the user. |
| 247 | + //This ootb "output" folder feature may be scrapped for something more generic in the future |
| 248 | + Console.WriteLine("Checking for output folder"); |
243 | 249 | if (!Directory.Exists(graphOutputFolder)) |
244 | 250 | { |
| 251 | + Console.WriteLine("Output folder does not exist. Creating.."); |
245 | 252 | Directory.CreateDirectory(graphOutputFolder); |
246 | 253 | } |
247 | 254 | } |
@@ -302,9 +309,7 @@ public void HandleDesignAutomationReadyEvent(object sender, DesignAutomationRead |
302 | 309 | DocumentManager.Instance.PrepareForDesignAutomation(app); |
303 | 310 |
|
304 | 311 | var loadedLibGVersion = ASMPrealoaderUtils.PreloadAsmFromRevit(asmLocation, DynamoPath); |
305 | | - Console.WriteLine($"{loadedLibGVersion}"); |
306 | 312 | var geometryFactoryPath = ASMPrealoaderUtils.GetGeometryFactoryPath(DynamoPath, loadedLibGVersion); |
307 | | - Console.WriteLine($"{geometryFactoryPath}"); |
308 | 313 |
|
309 | 314 | PreInstallPythonDependencies(); |
310 | 315 |
|
@@ -451,6 +456,20 @@ public void HandleDesignAutomationReadyEvent(object sender, DesignAutomationRead |
451 | 456 | } |
452 | 457 |
|
453 | 458 | model.RunCompleted += Model_RunCompleted; |
| 459 | + try |
| 460 | + { |
| 461 | + // If the out put folder exists and is empty, then delete it so we don't generate empty output zip files. |
| 462 | + if (Directory.Exists(graphOutputFolder) && !Directory.EnumerateFileSystemEntries(graphOutputFolder).Any()) |
| 463 | + { |
| 464 | + Console.WriteLine("The output folder is empty."); |
| 465 | + Directory.Delete(graphOutputFolder); |
| 466 | + } |
| 467 | + } |
| 468 | + catch (Exception ex) |
| 469 | + { |
| 470 | + Console.WriteLine($"Failed to delete the empty output folder. {ex.Message}"); |
| 471 | + } |
| 472 | + |
454 | 473 | e.Succeeded = true; |
455 | 474 | } |
456 | 475 |
|
|
0 commit comments