]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/Common/LongFilePathSupport.py
BaseTools: use single RegExp for token matching
[mirror_edk2.git] / BaseTools / Source / Python / Common / LongFilePathSupport.py
index 72dde20503ead3aac229091b857553c2f207b1f8..b3e3c8ea643f058412e17dbe19f5ff550e6aa668 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 # Override built in function file.open to provide support for long file path\r
 #\r
-# Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2014 - 2015, Intel Corporation. All rights reserved.<BR>\r
 # This program and the accompanying materials\r
 # are licensed and made available under the terms and conditions of the BSD License\r
 # which accompanies this distribution.  The full text of the license may be found at\r
@@ -14,6 +14,7 @@
 import os\r
 import platform\r
 import shutil\r
+import codecs\r
 \r
 ##\r
 # OpenLongPath\r
@@ -37,6 +38,9 @@ def LongFilePath(FileName):
 def OpenLongFilePath(FileName, Mode='r', Buffer= -1):\r
     return open(LongFilePath(FileName), Mode, Buffer)\r
 \r
+def CodecOpenLongFilePath(Filename, Mode='rb', Encoding=None, Errors='strict', Buffering=1):\r
+    return codecs.open(LongFilePath(Filename), Mode, Encoding, Errors, Buffering)\r
+\r
 ##\r
 # CopyLongFilePath\r
 # wrap copyfile to support copy a long file path\r