Skip to content

Commit 080585f

Browse files
committed
Default Output folder (#3306)
Add default output folder Check these if you believe they are true - [ ] The code base is in a better state after this PR - [ ] Is documented according to the [standards](https://github.com/DynamoDS/Dynamo/wiki/Coding-Standards) - [ ] The level of testing this PR includes is appropriate - [ ] User facing strings, if any, are extracted into `*.resx` files - [ ] Snapshot of UI changes, if any. (FILL ME IN) Reviewer 1 (If possible, assign the Reviewer for the PR) (FILL ME IN, optional) Any additional notes to reviewers or testers. (FILL ME IN, Optional) Names of anyone else you wish to be notified of
1 parent dc951f6 commit 080585f

1 file changed

Lines changed: 22 additions & 3 deletions

File tree

src/DADynamoApp/DAEntrypoint.cs

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
using System.Reflection;
1818
using System.Text.RegularExpressions;
1919
using static Dynamo.Models.DynamoModel;
20+
using DateTime = System.DateTime;
2021

2122
namespace DADynamoApp
2223
{
@@ -237,11 +238,17 @@ public void HandleDesignAutomationReadyEvent(object sender, DesignAutomationRead
237238
}
238239

239240
// Ensure we have a pre-built graph output folder.
241+
var graphOutputFolder = Path.Combine(WorkItemFolder, "output");
240242
try
241243
{
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");
243249
if (!Directory.Exists(graphOutputFolder))
244250
{
251+
Console.WriteLine("Output folder does not exist. Creating..");
245252
Directory.CreateDirectory(graphOutputFolder);
246253
}
247254
}
@@ -302,9 +309,7 @@ public void HandleDesignAutomationReadyEvent(object sender, DesignAutomationRead
302309
DocumentManager.Instance.PrepareForDesignAutomation(app);
303310

304311
var loadedLibGVersion = ASMPrealoaderUtils.PreloadAsmFromRevit(asmLocation, DynamoPath);
305-
Console.WriteLine($"{loadedLibGVersion}");
306312
var geometryFactoryPath = ASMPrealoaderUtils.GetGeometryFactoryPath(DynamoPath, loadedLibGVersion);
307-
Console.WriteLine($"{geometryFactoryPath}");
308313

309314
PreInstallPythonDependencies();
310315

@@ -451,6 +456,20 @@ public void HandleDesignAutomationReadyEvent(object sender, DesignAutomationRead
451456
}
452457

453458
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+
454473
e.Succeeded = true;
455474
}
456475

0 commit comments

Comments
 (0)