Skip to content

Commit

Permalink
Merge branch 'main' into bugfix/GSAGH-561-Contour-legend-in-Rhino-is-…
Browse files Browse the repository at this point in the history
…cropped
  • Loading branch information
DominikaLos authored Dec 2, 2024
2 parents 5f0e33d + 6519748 commit 26fd07f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
3 changes: 2 additions & 1 deletion GsaGH/Components/0_Model/SaveGsaModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public class SaveGsaModel : GH_OasysDropDownComponent {
public override OasysPluginInfo PluginInfo => GsaGH.PluginInfo.Instance;
protected override Bitmap Icon => Resources.SaveGsaModel;
private string _fileNameLastSaved;
internal string FileNameLastSavedFullPath => $"\"{Path.GetFullPath(_fileNameLastSaved)}\"";
private bool _saveInputOverride = false;

public SaveGsaModel() : base("Save GSA Model", "Save",
Expand Down Expand Up @@ -181,7 +182,7 @@ internal void OpenGsaExe() {
internal Process RunGsa() {
string programFiles = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles);
string fullPath = Path.Combine(programFiles, @"Oasys\GSA 10.2\GSA.exe");
return Process.Start(fullPath, Path.GetFullPath(_fileNameLastSaved));
return Process.Start(fullPath, FileNameLastSavedFullPath);
}
}
}
15 changes: 12 additions & 3 deletions GsaGHTests/3_Components/0_Model/SaveGsaModelTests.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Diagnostics;
using System.IO;
using System.IO;
using System.Linq;

using GsaGH.Components;
using GsaGH.Parameters;
Expand Down Expand Up @@ -66,5 +65,15 @@ public void StartGsaShouldTargetGsa() {
process.Kill();
}
}

[Fact]
public void StartGsaShouldWorkWhenFilenameHasGaps() {
SaveGsaModel comp = new SaveGsaModel();
ComponentTestHelper.SetInput(comp, GsaModelGooMother);
ComponentTestHelper.SetInput(comp, true, 1);
ComponentTestHelper.SetInput(comp, Path.Combine(Path.GetTempPath(), "dummyPath with spaces.gwb"), 2);
_ = (GsaModelGoo)ComponentTestHelper.GetOutput(comp);
Assert.Equal(2, comp.FileNameLastSavedFullPath.Count(x => x == '\"'));
}
}
}

0 comments on commit 26fd07f

Please sign in to comment.