-# 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
# 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
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
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