diff --git a/GsaGH/Components/0_Model/SaveGsaModel.cs b/GsaGH/Components/0_Model/SaveGsaModel.cs index c6adebb21..e3a6ab94e 100644 --- a/GsaGH/Components/0_Model/SaveGsaModel.cs +++ b/GsaGH/Components/0_Model/SaveGsaModel.cs @@ -91,7 +91,7 @@ protected override void SolveInternal(IGH_DataAccess da) { return; } - var gsaModel = new GsaModel(); + GsaModel gsaModel; if (ghTyp.Value is GsaModelGoo modelGoo) { gsaModel = modelGoo.Value; Message = string.Empty; @@ -175,8 +175,13 @@ internal void OpenGsaExe() { GsaModel gsaModel = tempModel.Value; Save(ref gsaModel, tempPath); } + RunGsa(); + } - Process.Start(_fileNameLastSaved); + 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)); } } } diff --git a/GsaGHTests/3_Components/0_Model/SaveGsaModelTests.cs b/GsaGHTests/3_Components/0_Model/SaveGsaModelTests.cs index 2b274a7e7..140cb1c4f 100644 --- a/GsaGHTests/3_Components/0_Model/SaveGsaModelTests.cs +++ b/GsaGHTests/3_Components/0_Model/SaveGsaModelTests.cs @@ -1,4 +1,6 @@ -using System.IO; +using System; +using System.Diagnostics; +using System.IO; using GsaGH.Components; using GsaGH.Parameters; @@ -49,5 +51,20 @@ public void SaveGsaModelTest(string filename) { Assert.True(File.Exists(expectedPath)); } + + [Fact] + public void StartGsaShouldTargetGsa() { + SaveGsaModel comp = new SaveGsaModel(); + ComponentTestHelper.SetInput(comp, GsaModelGooMother); + ComponentTestHelper.SetInput(comp, true, 1); + ComponentTestHelper.SetInput(comp, Path.Combine(Path.GetTempPath(), "dummyPath.gwb"), 2); + _ = (GsaModelGoo)ComponentTestHelper.GetOutput(comp); + var process = comp.RunGsa(); + try { + Assert.Contains("GSA", process.ProcessName); + } finally { + process.Kill(); + } + } } }