Skip to content

Commit

Permalink
owsavebase: wrap relpath into try except for win paths
Browse files Browse the repository at this point in the history
  • Loading branch information
markotoplak committed Feb 5, 2025
1 parent 8e2a9a7 commit e94ac2d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Orange/widgets/utils/save/owsavebase.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,13 @@ def last_dir(self, absolute_path):
self.stored_path = absolute_path
workflow_dir = self.workflowEnv().get("basedir", None)
if workflow_dir:
relative_path = os.path.relpath(absolute_path, start=workflow_dir)
if not relative_path.startswith(".."):
self.stored_path = relative_path
try:
relative_path = os.path.relpath(absolute_path, start=workflow_dir)
except ValueError: # on Windows for paths on different drives
pass
else:

Check warning on line 131 in Orange/widgets/utils/save/owsavebase.py

View check run for this annotation

Codecov / codecov/patch

Orange/widgets/utils/save/owsavebase.py#L130-L131

Added lines #L130 - L131 were not covered by tests
if not relative_path.startswith(".."):
self.stored_path = relative_path

def _abs_path_from_setting(self):
"""
Expand Down

0 comments on commit e94ac2d

Please sign in to comment.