#\r
# PackageFile class represents the zip file of a distribution package.\r
#\r
-# Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>\r
#\r
# This program and the accompanying materials are licensed and made available \r
# under the terms and conditions of the BSD License which accompanies this \r
from Logger import StringTable as ST\r
from Library.Misc import CreateDirectory\r
from Library.Misc import RemoveDirectory\r
-\r
+from Core.FileHook import __FileHookOpen__\r
\r
\r
class PackageFile:\r
## Extract the file\r
# \r
# @param Which: the source path \r
- # @param To: the destination path \r
+ # @param ToDest: the destination path \r
#\r
def Extract(self, Which, ToDest):\r
Which = os.path.normpath(Which)\r
Logger.Warn("PackagingTool", \\r
ST.WRN_FILE_NOT_OVERWRITTEN % ToDest)\r
return\r
- ToFile = open(ToDest, "wb")\r
+ else:\r
+ ToFile = __FileHookOpen__(ToDest, 'wb')\r
except BaseException, Xstr:\r
Logger.Error("PackagingTool", FILE_OPEN_FAILURE, \r
ExtraData="%s (%s)" % (ToDest, str(Xstr)))\r
#\r
def PackData(self, Data, ArcName):\r
try:\r
+ if os.path.splitext(ArcName)[1].lower() == '.pkg':\r
+ Data = Data.encode('utf_8')\r
self._ZipFile.writestr(ArcName, Data)\r
except BaseException, Xstr:\r
Logger.Error("PackagingTool", FILE_COMPRESS_FAILURE,\r