]> git.proxmox.com Git - mirror_edk2.git/blobdiff - AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Lib/ntpath.py
AppPkg/.../Python-2.7.10: AppPkg.dsc, pyconfig.h, PyMod-2.7.10
[mirror_edk2.git] / AppPkg / Applications / Python / Python-2.7.10 / PyMod-2.7.10 / Lib / ntpath.py
index ac89e2c9fe84b6e04fea0f5dcb2caa0ec4079963..ab10a28ac885afd84bd0552e718ca716261f3bea 100644 (file)
@@ -1,5 +1,18 @@
-# Module 'ntpath' -- common operations on WinNT/Win95 pathnames\r
-"""Common pathname manipulations, WindowsNT/95 version.\r
+\r
+# Module 'ntpath' -- common operations on WinNT/Win95 and UEFI pathnames.\r
+#\r
+# Copyright (c) 2015, Daryl McDaniel. All rights reserved.<BR>\r
+# Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.<BR>\r
+# This program and the accompanying materials are licensed and made available under\r
+# the terms and conditions of the BSD License that accompanies this distribution.\r
+# The full text of the license may be found at\r
+# http://opensource.org/licenses/bsd-license.\r
+#\r
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+\r
+"""Common pathname manipulations, WindowsNT/95 and UEFI version.\r
 \r
 Instead of importing this module directly, import os and refer to this\r
 module as os.path.\r
@@ -93,6 +106,9 @@ def join(path, *paths):
 # Split a path in a drive specification (a drive letter followed by a\r
 # colon) and the path specification.\r
 # It is always true that drivespec + pathspec == p\r
+# NOTE: for UEFI (and even Windows) you can have multiple characters to the left\r
+# of the ':' for the device or drive spec.  This is reflected in the modifications\r
+# to splitdrive() and splitunc().\r
 def splitdrive(p):\r
     """Split a pathname into drive/UNC sharepoint and relative path specifiers.\r
     Returns a 2-tuple (drive_or_unc, path); either part may be empty.\r
@@ -130,8 +146,10 @@ def splitdrive(p):
             if index2 == -1:\r
                 index2 = len(p)\r
             return p[:index2], p[index2:]\r
-        if normp[1] == ':':\r
-            return p[:2], p[2:]\r
+        index = p.find(':')\r
+        if index != -1:\r
+            index = index + 1\r
+            return p[:index], p[index:]\r
     return '', p\r
 \r
 # Parse UNC paths\r
@@ -143,8 +161,8 @@ def splitunc(p):
     using backslashes).  unc+rest is always the input path.\r
     Paths containing drive letters never have an UNC part.\r
     """\r
-    if p[1:2] == ':':\r
-        return '', p # Drive letter present\r
+    if ':' in p:\r
+        return '', p # Drive letter or device name present\r
     firstTwo = p[0:2]\r
     if firstTwo == '//' or firstTwo == '\\\\':\r
         # is a UNC path:\r