Skip to content

Commit 00c9bfc

Browse files
author
Geniucker
committed
fix #5: fix fatal error in connection function
1 parent 1904d58 commit 00c9bfc

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

tools/initialize.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ def connect() -> int:
2020
print("你没有安装usbmuxd,请再次阅读README中关于Linux的部分")
2121
input("按回车退出")
2222
else:
23-
utils.cmd(["xattr", "-d", "-r", "com.apple.quarantine", "."], getoutp=False)
23+
quarantine = not -1 == utils.cmd(["xattr", "libimobiledevice/darwin/ideviceinfo"], libimobiledevice=False).find("quarantine")
24+
if quarantine:
25+
os.system("sudo xattr -d -r com.apple.quarantine .")
2426

2527
input("请解锁手机或Pad后按回车")
2628
status = utils.pair()

tools/utils.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
def cmd(i_cmd, getoutp=True):
1+
def cmd(i_cmd, getoutp=True, libimobiledevice=True):
22
from main import seperator
33
from main import libimobiledeviceDir
44
from main import OS, env
55
import subprocess
6-
if type(i_cmd) == str:
7-
i_cmd = seperator.join([libimobiledeviceDir, i_cmd])
8-
else:
9-
i_cmd[0] = seperator.join([libimobiledeviceDir, i_cmd[0]])
6+
if libimobiledevice:
7+
if type(i_cmd) == str:
8+
i_cmd = seperator.join([libimobiledeviceDir, i_cmd])
9+
else:
10+
i_cmd[0] = seperator.join([libimobiledeviceDir, i_cmd[0]])
1011
if getoutp:
1112
return subprocess.Popen(i_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env[OS]).stdout.read().decode("utf-8")
1213
else:

0 commit comments

Comments
 (0)