예제 #1
0
 def getApkApplicationIconPath(self, apkPath, apkInfo=None):
     apkPath = unicode(apkPath)
     applicationIconStr = self.getApkApplicationIconPathInApk(
         apkPath, apkInfo)
     if not applicationIconStr:
         return u'未获取到应用图标'
     apkZip = zipfile.ZipFile(apkPath)
     iconData = apkZip.read(applicationIconStr)
     iconDestPath = FileUtil.getFilePathWithName(apkPath)
     FileUtil.mkdirNotExist(iconDestPath)
     saveIconPath = os.path.join(iconDestPath, 'icon_launcher.png')
     if FileUtil.isFileOrDirExist(saveIconPath):
         return saveIconPath
     with open(saveIconPath, 'w+b') as saveIcon:
         saveIcon.write(iconData)
     return saveIconPath