Skip to content

Commit

Permalink
🐛 currentDirectory
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco-Pellegrino committed Feb 13, 2024
1 parent a48238e commit 671fa75
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions FemDesign.Grasshopper/Model/ModelReadFromFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,29 @@ protected override void SolveInstance(IGH_DataAccess DA)
{
// get indata
string filePath = null;
if (!DA.GetData(0, ref filePath))
DA.GetData(0, ref filePath);


if (_FileName.IsASCII(filePath))
this.AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "File path has special characters. This might cause problems.");


bool fileExist = OnPingDocument().IsFilePathDefined;
if (!fileExist)
{
return;
// hops issue
//var folderPath = System.IO.Directory.GetCurrentDirectory();
string tempPath = System.IO.Path.GetTempPath();
System.IO.Directory.SetCurrentDirectory(tempPath);
}

if (filePath == null)
else
{
return;
filePath = OnPingDocument().FilePath;
var currentDir = System.IO.Path.GetDirectoryName(filePath);
System.IO.Directory.SetCurrentDirectory(currentDir);
}

if (_FileName.IsASCII(filePath))
this.AddRuntimeMessage(GH_RuntimeMessageLevel.Warning, "File path has special characters. This might cause problems.");



Model model = null;
Expand Down

0 comments on commit 671fa75

Please sign in to comment.