Skip to content

Fix split filename #1035

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 30, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Next release
============

* FIX: Fix split_filename behaviour when path has no file component (https://github.com/nipy/nipype/pull/1035)
* ENH: Updated FSL dtifit to include option for grad non-linearities (https://github.com/nipy/nipype/pull/1032)
* ENH: Updated Camino tracking interfaces, which can now use FSL bedpostx output.
New options also include choice of tracker, interpolator, stepsize and
Expand Down
6 changes: 2 additions & 4 deletions nipype/utils/filemanip.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,8 @@ def split_filename(fname):

special_extensions = [".nii.gz", ".tar.gz"]

if fname and fname.endswith(os.path.sep):
fname = fname[:-1]

pth, fname = os.path.split(fname)
pth = os.path.dirname(fname)
fname = os.path.basename(fname)

ext = None
for special_ext in special_extensions:
Expand Down
2 changes: 2 additions & 0 deletions nipype/utils/tests/test_filemanip.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ def test_split_filename():
yield assert_equal, res, ('../usr/local', 'foo', '.nii')
res = split_filename('/usr/local/foo.a.b.c.d')
yield assert_equal, res, ('/usr/local', 'foo.a.b.c', '.d')
res = split_filename('/usr/local/')
yield assert_equal, res, ('/usr/local', '', '')

def test_fname_presuffix():
fname = 'foo.nii'
Expand Down