feat: enhance ADB path resolution and update HTTP request handling for improved flexibility

This commit is contained in:
Nixevol
2026-09-27 14:37:51 +08:00
parent 3449adb721
commit fdb1f73968
8 changed files with 373 additions and 20 deletions
+8 -4
View File
@@ -24,10 +24,14 @@ class Adb:
raise RuntimeError(f"找不到 adb:{explicit}")
return cls(explicit)
name = "adb.exe" if os.name == "nt" else "adb"
path = REPO_ROOT / "tools" / "platform-tools" / name
if not path.is_file():
raise RuntimeError(f"项目内没有 adb:{path}")
return cls(str(path))
candidates = [
REPO_ROOT / "tools" / "platform-tools" / name,
REPO_ROOT / "vendor" / "platform-tools" / name,
]
for path in candidates:
if path.is_file():
return cls(str(path))
raise RuntimeError(f"项目内没有 adb:{candidates[0]}")
def list_devices(self) -> list[dict]:
proc = self._run(["devices", "-l"])