Fix specifying a root directory with just the drive string (e.g. C:).
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Sun, 9 Nov 2003 04:16:29 +0000 (04:16 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Sun, 9 Nov 2003 04:16:29 +0000 (04:16 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@842 fdb21ef1-2011-0410-befe-b5e4ea1792b1

src/CHANGES.txt
src/engine/SCons/Node/FS.py
src/engine/SCons/Node/FSTests.py

index 6b2a89eb70e0328d1d265ba61ad9fe0b32d695b1..06ef176a28aaadb43c82fcc855d1f16509218919 100644 (file)
@@ -20,6 +20,8 @@ RELEASE 0.95 - XXX
 
   - Fix an odd double-quote escape sequence in the man page.
 
+  - Fix looking up a naked drive letter as a directory (Dir('C:')).
+
 
 
 RELEASE 0.94 - Fri, 07 Nov 2003 05:29:48 -0600
index bce5364dfdbd3014a110db98ff24f6b5495403ad..e7ab14a339a0b7afb8c0349542c01b1406a483c9 100644 (file)
@@ -646,6 +646,9 @@ class FS:
             path_comp = path_comp[1:]
         else:
             path_comp = [ path_first, ] + path_comp[1:]
+
+        if not path_comp:
+            path_comp = ['']
             
         # Lookup the directory
         for path_name in path_comp[:-1]:
index 54c6523b9b34f13606fe7537d1de5d194766c3c8..cbda75837eaeab14b75d763e6d6cb2a5d3a5ee87 100644 (file)
@@ -673,6 +673,17 @@ class FSTestCase(unittest.TestCase):
             except:
                 raise
 
+            # Test that just specifying the drive works to identify
+            # its root directory.
+            p = os.path.abspath(test.workpath('root_file'))
+            drive, path = os.path.splitdrive(p)
+            if drive:
+                # The assert below probably isn't correct for the
+                # general case, but it works for Win32, which covers a
+                # lot of ground...
+                dir = fs.Dir(drive)
+                assert str(dir) == drive + os.sep, str(dir)
+
             # Test Dir.children()
             dir = fs.Dir('ddd')
             fs.File(string.join(['ddd', 'f1'], sep))