| 317 | AppLog.info('update thread started') |
| 318 | |
| 319 | def unzip(self, file): |
| 320 | # 进行解压 |
| 321 | zipfile = ZipFile(file) |
| 322 | path = os.path.abspath('.') |
| 323 | members = zipfile.namelist() |
| 324 | for zipinfo in members: |
| 325 | _name = zipinfo.lower() |
| 326 | if _name.endswith('.exe') or \ |
| 327 | _name.endswith('.dll') or \ |
| 328 | _name.endswith('.ttf') or \ |
| 329 | _name.endswith('.so') or \ |
| 330 | _name.endswith('.dylib'): |
| 331 | tpath = os.path.abspath(os.path.join(path, zipinfo)) |
| 332 | # 需要重命名当前正在占用的文件 |
| 333 | if os.path.isfile(tpath): |
| 334 | os.rename(tpath, tpath + str(time()) + '.old') |
| 335 | zipfile.extract(zipinfo, path) |
| 336 | |
| 337 | |
| 338 | # zipfile.extractall(os.path.abspath('.')) |
| 339 | zipfile.close() |
| 340 | |
| 341 | def download(self, file, url): |
| 342 | AppLog.debug('start download {}'.format(url)) |