From 8a0e2ae241f76fd70350af6a442c07592f524e9f Mon Sep 17 00:00:00 2001 From: MP <53620289+Marco-Pellegrino@users.noreply.github.com> Date: Thu, 26 Oct 2023 11:57:39 +0200 Subject: [PATCH] :up: user must save the file to run the script if .gh file was not saved, the script would have tried to save the file in a ProgramFiles which is not accessible most of the time --- FemDesign.Grasshopper/Calculate/ApplicationRun.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/FemDesign.Grasshopper/Calculate/ApplicationRun.cs b/FemDesign.Grasshopper/Calculate/ApplicationRun.cs index 94f5d71d2..c3ab0ac03 100644 --- a/FemDesign.Grasshopper/Calculate/ApplicationRun.cs +++ b/FemDesign.Grasshopper/Calculate/ApplicationRun.cs @@ -151,8 +151,14 @@ protected override void SolveInstance(IGH_DataAccess DA) } + // check if .gh file exist to store the .fdscript/.csv/.struxml file in the same folder bool fileExist = OnPingDocument().IsFilePathDefined; - var filePath = fileExist == false ? System.IO.Directory.GetCurrentDirectory() : OnPingDocument().FilePath; + if (!fileExist) + { + AddRuntimeMessage(GH_RuntimeMessageLevel.Error, "Save your .gh script or specfy a FilePath."); + return; + } + string filePath = OnPingDocument().FilePath; var outputDir = System.IO.Path.GetDirectoryName(filePath);