We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2328beb commit 6d4e821Copy full SHA for 6d4e821
nipype/utils/filemanip.py
@@ -64,10 +64,19 @@ def path_resolve(path, strict=False):
64
try:
65
return path.resolve(strict=strict)
66
except TypeError: # PY35
67
- resolved = path.resolve()
68
- if strict and not resolved.exists():
69
- raise FileNotFoundError(resolved)
70
- return resolved
+ pass
+
+ path = path.absolute()
+ if strict or path.exists():
71
+ try:
72
+ return path.resolve()
73
+ except OSError:
74
+ raise FileNotFoundError(str(path))
75
76
+ # This is a hacky shortcut, using path.absolute() unmodified
77
+ # In cases where the existing part of the path contains a
78
+ # symlink, different results will be produced
79
+ return path
80
81
82
def path_mkdir(path, mode=0o777, parents=False, exist_ok=False):
0 commit comments