changeset 1495:625fe86e3d5e

Merged
author Olivier Delalleau <delallea@iro>
date Wed, 17 Aug 2011 10:18:59 -0400
parents 0e6ca7eecc72 (current diff) b1af99fd7bf6 (diff)
children 93b8373c6735
files
diffstat 1 files changed, 10 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/pylearn/datasets/config.py	Wed Aug 17 10:18:39 2011 -0400
+++ b/pylearn/datasets/config.py	Wed Aug 17 10:18:59 2011 -0400
@@ -41,14 +41,16 @@
     if roots is None:
         roots = [data_root()]
     else:
-        roots = roots.split(':')
-    roots2 = []
-    #remove directory that don't exist
-    for root in roots:
-        if os.path.exists(root):
-            roots2.append(root)
-    data_roots.rval = roots2
-    return roots2
+        # Note that under Windows, we cannot use ':' as a delimiter because
+        # paths may contain this character. Thus we use ';' instead (similar to
+        # the PATH environment variable in Windows).
+        if sys.platform == 'win32':
+            roots = roots.split(';')
+        else:
+            roots = roots.split(':')
+    # Remove paths that are not directories.
+    data_roots.rval = [r for r in roots if os.path.isdir(r)]
+    return data_roots.rval
 
 
 def get_filepath_in_roots(*names):