From f5e8df7d87424061ab5d377cee2865acaac0b88a Mon Sep 17 00:00:00 2001 From: dkunhamb Date: Wed, 23 Jul 2025 16:02:28 -0500 Subject: [PATCH 1/2] relative path --- src/ansys/mechanical/core/embedding/app.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/ansys/mechanical/core/embedding/app.py b/src/ansys/mechanical/core/embedding/app.py index 07e06997d0..12f80ff0ee 100644 --- a/src/ansys/mechanical/core/embedding/app.py +++ b/src/ansys/mechanical/core/embedding/app.py @@ -302,9 +302,15 @@ def open(self, db_file, remove_lock=False): def save(self, path=None): """Save the project.""" if path is not None: + if os.path.isabs(path): + self.DataModel.Project.Save(path) + else: + cwd = os.getcwd() + path = os.path.join(cwd, path) self.DataModel.Project.Save(path) else: self.DataModel.Project.Save() + LOG.info(f"Project saved to {path}") def save_as(self, path: str, overwrite: bool = False, remove_lock: bool = False): """ @@ -331,6 +337,9 @@ def save_as(self, path: str, overwrite: bool = False, remove_lock: bool = False) For version 232, if `overwrite` is True, the existing file and its associated directory (if any) will be removed before saving the new file. """ + if not os.path.isabs(path): + cwd = os.getcwd() + path = os.path.join(cwd, path) if not os.path.exists(path): self.DataModel.Project.SaveAs(path) return @@ -373,6 +382,7 @@ def save_as(self, path: str, overwrite: bool = False, remove_lock: bool = False) else: self.log_error(f"Failed to save project as {path}: {error_msg}") raise e + LOG.info(f"Project saved as {path}") def launch_gui(self, delete_tmp_on_close: bool = True, dry_run: bool = False): """Launch the GUI.""" From 4d2480d117dc92ace658155c6e38f90f701c60fb Mon Sep 17 00:00:00 2001 From: pyansys-ci-bot <92810346+pyansys-ci-bot@users.noreply.github.com> Date: Wed, 23 Jul 2025 21:05:17 +0000 Subject: [PATCH 2/2] chore: adding changelog file 1253.fixed.md [dependabot-skip] --- doc/changelog.d/1253.fixed.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 doc/changelog.d/1253.fixed.md diff --git a/doc/changelog.d/1253.fixed.md b/doc/changelog.d/1253.fixed.md new file mode 100644 index 0000000000..e1cb03ab84 --- /dev/null +++ b/doc/changelog.d/1253.fixed.md @@ -0,0 +1 @@ +Relative path for saving \ No newline at end of file