Skip to content

Commit

Permalink
Merge pull request #193 from ales-erjavec/workflow-basedir-absolute-path
Browse files Browse the repository at this point in the history
canvasmain: Always use absolute path for 'basedir'
  • Loading branch information
janezd authored Jun 4, 2021
2 parents a81bb8b + 49ed844 commit 2d5ad73
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions orangecanvas/application/canvasmain.py
Original file line number Diff line number Diff line change
Expand Up @@ -1234,7 +1234,8 @@ def new_scheme_from_contents_and_path(
workflow: Optional[Scheme]
"""
new_scheme = config.workflow_constructor(parent=self)
new_scheme.set_runtime_env("basedir", os.path.dirname(path))
new_scheme.set_runtime_env(
"basedir", os.path.abspath(os.path.dirname(path)))
errors = [] # type: List[Exception]
try:
new_scheme.load_from(
Expand Down Expand Up @@ -1508,7 +1509,7 @@ def save_scheme_to(self, scheme, filename):
# existing scheme file if `scheme.save_to` raises an error.
buffer = io.BytesIO()
try:
scheme.set_runtime_env("basedir", dirname)
scheme.set_runtime_env("basedir", os.path.abspath(dirname))
scheme.save_to(buffer, pretty=True, pickle_fallback=True)
except Exception:
log.error("Error saving %r to %r", scheme, filename, exc_info=True)
Expand Down

0 comments on commit 2d5ad73

Please sign in to comment.