Skip to content

Commit 7d1d60c

Browse files
Update src/ansys/mechanical/core/embedding/app.py
Co-authored-by: Kerry McAdams <[email protected]>
1 parent eed0869 commit 7d1d60c

File tree

1 file changed

+3
-6
lines changed
  • src/ansys/mechanical/core/embedding

1 file changed

+3
-6
lines changed

src/ansys/mechanical/core/embedding/app.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -350,12 +350,9 @@ def save_as(self, path: str, overwrite: bool = False, remove_lock: bool = False)
350350
self.DataModel.Project.SaveAs(path)
351351
else:
352352
if remove_lock:
353-
file_name = os.path.basename(path)
354-
file_dir = os.path.dirname(path)
355-
associated_dir = os.path.join(
356-
file_dir, os.path.splitext(file_name)[0] + "_Mech_Files"
357-
)
358-
lock_file = Path(associated_dir) / ".mech_lock"
353+
file_path = Path(path)
354+
associated_dir = file_path.parent / f"{file_path.stem}_Mech_Files"
355+
lock_file = associated_dir / ".mech_lock"
359356
# Remove the lock file if it exists before saving the project file
360357
if lock_file.exists():
361358
self.log_warning(f"Removing the lock file, {lock_file}... ")

0 commit comments

Comments
 (0)