Skip to content
Snippets Groups Projects

Small io fixes

Merged Tobias Hangleiter requested to merge hotfix/io into master
1 file
+ 5
2
Compare changes
  • Side-by-side
  • Inline
+ 5
2
@@ -124,7 +124,7 @@ def query_overwrite(filepath: Union[str, os.PathLike], default: str = 'no') -> p
try:
filepath = input('Enter a new file name or path or press Ctrl-C to abort: ')
except KeyboardInterrupt:
raise FileExistsError(filepath)
raise FileExistsError(filepath) from None
return filepath
@@ -187,7 +187,10 @@ def to_global_path(path: Union[str, os.PathLike], warn: bool = False) -> pathlib
if root[0] in string.ascii_uppercase and root[1] == ':':
# Resolve a mapped network share
root = os.path.realpath(root)
return pathlib.Path(root, *rest)
if path != (newpath := pathlib.Path(root, *rest)):
# Recursively resolve hosts
return to_global_path(newpath, warn)
return path
def check_path_length(path: Union[str, os.PathLike], ask_for_new: bool = True) -> pathlib.Path:
Loading