Skip to content
Snippets Groups Projects
Commit 54507efa authored by Paul McCarthy's avatar Paul McCarthy :mountain_bicyclist:
Browse files

RF: fixExt can pass arguments through to addExt

parent 29e59f44
No related branches found
No related tags found
No related merge requests found
...@@ -1625,18 +1625,20 @@ def removeExt(filename): ...@@ -1625,18 +1625,20 @@ def removeExt(filename):
return fslpath.removeExt(filename, ALLOWED_EXTENSIONS) return fslpath.removeExt(filename, ALLOWED_EXTENSIONS)
def fixExt(filename): def fixExt(filename, **kwargs):
"""Fix the extension of ``filename``. """Fix the extension of ``filename``.
For example, if a file name is passed in as ``file.nii.gz``, but the For example, if a file name is passed in as ``file.nii.gz``, but the
file is actually ``file.nii``, this function will fix the file name. file is actually ``file.nii``, this function will fix the file name.
If ``filename`` already exists, it is returned unchanged. If ``filename`` already exists, it is returned unchanged.
All other arguments are passed through to :func:`addExt`.
""" """
if op.exists(filename): if op.exists(filename):
return filename return filename
else: else:
return addExt(removeExt(filename)) return addExt(removeExt(filename), **kwargs)
def defaultExt(): def defaultExt():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment