diff --git a/GsaGH/Components/0_Model/SaveGsaModel.cs b/GsaGH/Components/0_Model/SaveGsaModel.cs index e3a6ab94e..5d54d7281 100644 --- a/GsaGH/Components/0_Model/SaveGsaModel.cs +++ b/GsaGH/Components/0_Model/SaveGsaModel.cs @@ -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", @@ -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); } } } diff --git a/GsaGHTests/3_Components/0_Model/SaveGsaModelTests.cs b/GsaGHTests/3_Components/0_Model/SaveGsaModelTests.cs index 140cb1c4f..cfaf41ace 100644 --- a/GsaGHTests/3_Components/0_Model/SaveGsaModelTests.cs +++ b/GsaGHTests/3_Components/0_Model/SaveGsaModelTests.cs @@ -1,6 +1,5 @@ -using System; -using System.Diagnostics; -using System.IO; +using System.IO; +using System.Linq; using GsaGH.Components; using GsaGH.Parameters; @@ -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 == '\"')); + } } }