mailr23781 - /trunk/lib/io.py


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by edward on June 10, 2014 - 10:13:
Author: bugman
Date: Tue Jun 10 10:13:29 2014
New Revision: 23781

URL: http://svn.gna.org/viewcvs/relax?rev=23781&view=rev
Log:
Bug fix for the lib.io.file_root() function for multiple file extensions.

The function will now strip off all file extensions.


Modified:
    trunk/lib/io.py

Modified: trunk/lib/io.py
URL: 
http://svn.gna.org/viewcvs/relax/trunk/lib/io.py?rev=23781&r1=23780&r2=23781&view=diff
==============================================================================
--- trunk/lib/io.py     (original)
+++ trunk/lib/io.py     Tue Jun 10 10:13:29 2014
@@ -165,8 +165,13 @@
     @rtype:             str
     """
 
-    root, ext = splitext(file_path)
-    return basename(root)
+    # Loop over all file extensions, stopping when none are left.
+    ext = None
+    while ext != '':
+        file_path, ext = splitext(file_path)
+
+    # Return the file root with the directories stripped.
+    return basename(file_path)
 
 
 def get_file_path(file_name=None, dir=None):




Related Messages


Powered by MHonArc, Updated Tue Jun 10 10:20:02 2014