()
| 38 | httpd.shutdown() |
| 39 | |
| 40 | def main(): |
| 41 | if appex.is_running_extension(): |
| 42 | get_path = appex.get_file_path() |
| 43 | file_name = path.basename(get_path) |
| 44 | file_ext = path.splitext(file_name)[-1] |
| 45 | if file_ext == '.ipa': |
| 46 | dstpath = path.join(save_dir, 'app.ipa') |
| 47 | try: |
| 48 | shutil.copy(get_path, dstpath) |
| 49 | |
| 50 | except Exception as eer: |
| 51 | print(eer) |
| 52 | console.hud_alert('导入失败!','error',1) |
| 53 | start(port_number) |
| 54 | if httpd: |
| 55 | webbrowser.open(plist_url) |
| 56 | try: |
| 57 | finish = console.alert(file_name, '\n正在安装...请返回桌面查看进度...\n\n安装完成后请返回点击已完成','已完成', hide_cancel_button=False) |
| 58 | if finish == 1: |
| 59 | stop() |
| 60 | shutil.rmtree('./ipa') |
| 61 | print("Server stopped") |
| 62 | except: |
| 63 | stop() |
| 64 | shutil.rmtree('./ipa') |
| 65 | print("Cancelled") |
| 66 | appex.finish() |
| 67 | else: |
| 68 | console.hud_alert('非 ipa 文件无法导入安装', 'error', 2) |
| 69 | appex.finish() |
| 70 | else: |
| 71 | console.hud_alert('请在分享扩展中打开本脚本','error',2) |
| 72 | |
| 73 | if __name__ == '__main__': |
| 74 | main() |
no test coverage detected