Skip to content

Commit

Permalink
🆙 user must save the file to run the script
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Marco-Pellegrino committed Oct 26, 2023
1 parent ad53e79 commit 8a0e2ae
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion FemDesign.Grasshopper/Calculate/ApplicationRun.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);


Expand Down

0 comments on commit 8a0e2ae

Please sign in to comment.