## @file\r
# This is the base class for applications that operate on an EDK II Workspace \r
#\r
-# Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2007 - 2014, 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
##\r
# Import Modules\r
#\r
-import os, sys, time\r
+import Common.LongFilePathOs as os, sys, time\r
from DataType import *\r
+from Common.LongFilePathSupport import OpenLongFilePath as open\r
+from Common.MultipleWorkspace import MultipleWorkspace as mws\r
\r
## EdkIIWorkspace\r
#\r
#\r
# Load TianoCoreOrgLogo, used for GUI tool\r
#\r
- self.Icon = wx.Icon(self.WorkspaceFile('tools/Python/TianoCoreOrgLogo.gif'),wx.BITMAP_TYPE_GIF)\r
+ self.Icon = wx.Icon(self.WorkspaceFile('tools/Python/TianoCoreOrgLogo.gif'), wx.BITMAP_TYPE_GIF)\r
except:\r
self.Icon = None\r
\r
# @retval string The full path filename\r
#\r
def WorkspaceFile(self, FileName):\r
- return os.path.realpath(os.path.join(self.WorkspaceDir,FileName))\r
+ return os.path.realpath(mws.join(self.WorkspaceDir,FileName))\r
\r
## Convert to a real path filename\r
#\r
def XmlParseFileSection (self, FileName, SectionTag):\r
if self.Verbose:\r
print FileName\r
- return XmlParseFileSection (self.WorkspaceFile(FileName), SectionTag) \r
+ return XmlParseFileSection (self.WorkspaceFile(FileName), SectionTag)\r
\r
## Save a XML file\r
#\r
#\r
def ConvertTextFileToDictionary(FileName, Dictionary, CommentCharacter, KeySplitCharacter, ValueSplitFlag, ValueSplitCharacter):\r
try:\r
- F = open(FileName,'r')\r
+ F = open(FileName, 'r')\r
except:\r
return False\r
Keys = []\r
for Line in F:\r
- LineList = Line.split(KeySplitCharacter,1)\r
+ LineList = Line.split(KeySplitCharacter, 1)\r
if len(LineList) >= 2:\r
Key = LineList[0].split()\r
- if len(Key) == 1 and Key[0][0] != CommentCharacter and Key[0] not in Keys: \r
+ if len(Key) == 1 and Key[0][0] != CommentCharacter and Key[0] not in Keys:\r
if ValueSplitFlag:\r
- Dictionary[Key[0]] = LineList[1].replace('\\','/').split(ValueSplitCharacter)\r
+ Dictionary[Key[0]] = LineList[1].replace('\\', '/').split(ValueSplitCharacter)\r
else:\r
- Dictionary[Key[0]] = LineList[1].strip().replace('\\','/')\r
+ Dictionary[Key[0]] = LineList[1].strip().replace('\\', '/')\r
Keys += [Key[0]]\r
F.close()\r
return True\r
#\r
def ConvertDictionaryToTextFile(FileName, Dictionary, CommentCharacter, KeySplitCharacter, ValueSplitFlag, ValueSplitCharacter):\r
try:\r
- F = open(FileName,'r')\r
+ F = open(FileName, 'r')\r
Lines = []\r
Lines = F.readlines()\r
F.close()\r
MaxLength = len(Key)\r
Index = 0\r
for Line in Lines:\r
- LineList = Line.split(KeySplitCharacter,1)\r
+ LineList = Line.split(KeySplitCharacter, 1)\r
if len(LineList) >= 2:\r
Key = LineList[0].split()\r
if len(Key) == 1 and Key[0][0] != CommentCharacter and Key[0] in Dictionary:\r
Line = '%-*s %c %s\n' % (MaxLength, Key[0], KeySplitCharacter, Dictionary[Key[0]])\r
Lines.pop(Index)\r
if Key[0] in Keys:\r
- Lines.insert(Index,Line)\r
+ Lines.insert(Index, Line)\r
Keys.remove(Key[0])\r
Index += 1\r
for RemainingKey in Keys:\r
if ValueSplitFlag:\r
- Line = '%-*s %c %s\n' % (MaxLength, RemainingKey, KeySplitCharacter,' '.join(Dictionary[RemainingKey])) \r
+ Line = '%-*s %c %s\n' % (MaxLength, RemainingKey, KeySplitCharacter, ' '.join(Dictionary[RemainingKey]))\r
else:\r
Line = '%-*s %c %s\n' % (MaxLength, RemainingKey, KeySplitCharacter, Dictionary[RemainingKey])\r
Lines.append(Line)\r
try:\r
- F = open(FileName,'w')\r
+ F = open(FileName, 'w')\r
except:\r
return False\r
F.writelines(Lines)\r