Commit c3e50e94 authored by Paul McCarthy's avatar Paul McCarthy 🚵
Browse files

MNT: Convert all Path arguments to absolute path strings

parent 759da952
......@@ -874,11 +874,8 @@ class FileOrThing:
# accept an output prefix which contains
# a directory path.
if prefix is not None:
# Accept pathlib, but all the
# code below works on strings
if isinstance(prefix, pathlib.Path):
prefix = str(prefix)
prefix = op.abspath(prefix)
# If prefix is set to LOAD,
# all generated output files
......@@ -971,6 +968,15 @@ class FileOrThing:
if realPrefix is not None and len(prefixedFiles) == 0:
allargs[self.__outprefix] = realPrefix
# Turn any Path objects into absolute path
# strings. Don't use Path.resolve(), as it
# returns a relative path for non-existent
# files/dirs on Windows/certain Python
# versions.
for k, v in allargs.items():
if isinstance(v, pathlib.Path):
allargs[k] = op.abspath(v)
args = [allargs.pop(k) for k in argnames]
kwargs = allargs
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment