The following commit has been merged in the master branch:
commit e8d23f99f862d6028afa3c0e13ec18ab06127567
Author: Andrei Zavada <[email protected]>
Date:   Thu Apr 25 14:13:02 2013 +0300

    clearer code for dealing with files like Episode-2.edf in tree scanner

diff --git a/src/expdesign/tree-scanner.cc b/src/expdesign/tree-scanner.cc
index 25b88c8..42ef454 100644
--- a/src/expdesign/tree-scanner.cc
+++ b/src/expdesign/tree-scanner.cc
@@ -143,10 +143,16 @@ register_intree_source( sigfile::CTypedSource&& F,
                        d_name = (pe = next(pe), *pe),
                        e_name = fs::make_fname_base(*next(pe), ".edf", false);
                // take care of the case of episode-2.edf
-               if ( e_name.size() >= 3 /* strlen("a-1") */ ) {
-                       size_t sz = e_name.size();
-                       if ( e_name[sz-2] == '-' && isdigit(e_name[sz-1]) )
-                               e_name.erase( sz-2, 2);
+               {
+                       auto subf = agh::str::tokens_trimmed(e_name, "-");
+                       if ( subf.size() == 2 ) {
+                               try {
+                                       stoi(subf.back());
+                                       e_name = subf.front();
+                               } catch (...) {
+                                       ;
+                               }
+                       }
                }
 
                // refuse to register sources of wrong subjects

-- 
Sleep experiment manager

_______________________________________________
debian-med-commit mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/debian-med-commit

Reply via email to