Skip to content

Commit ba3652f

Browse files
committed
Fix windows path issues with tools
1 parent 9d22069 commit ba3652f

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

openandroidinstaller/tool_utils.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@
2828
def call_tool_with_command(command: str, bin_path: Path) -> bool:
2929
"""Call an executable with a specific command."""
3030
if PLATFORM == "win32":
31-
command = re.sub(r"^adb", re.escape(str(bin_path.joinpath(Path("adb.exe")))), command)
32-
command = re.sub(r"^fastboot", re.escape(str(bin_path.joinpath(Path("fastboot.exe")))), command)
33-
command = re.sub(r"^heimdall", re.escape(str(bin_path.joinpath(Path("heimdall.exe")))), command)
31+
command = re.sub(r"^adb", re.escape(str(bin_path.joinpath(Path("adb")))) + ".exe", command)
32+
command = re.sub(r"^fastboot", re.escape(str(bin_path.joinpath(Path("fastboot.exe")))) + ".exe", command)
33+
command = re.sub(r"^heimdall", re.escape(str(bin_path.joinpath(Path("heimdall.exe")))) + ".exe", command)
3434
else:
3535
command = re.sub(r"^adb", re.escape(str(bin_path.joinpath(Path("adb")))), command)
3636
command = re.sub(r"^fastboot", re.escape(str(bin_path.joinpath(Path("fastboot")))), command)
@@ -73,11 +73,13 @@ def search_device(platform: str, bin_path: Path) -> Optional[str]:
7373
"findstr",
7474
"ro.product.device",
7575
],
76-
stderr=STDOUT,
76+
stderr=STDOUT, shell=True,
7777
).decode()
7878
else:
7979
raise Exception(f"Unknown platform {platform}.")
80-
return output.split("[")[-1].strip()[:-1].strip()
80+
device_code = output.split("[")[-1].strip()[:-1].strip()
81+
logger.info(device_code)
82+
return device_code
8183
except CalledProcessError:
8284
logger.info(f"Did not detect a device.")
8385
return None

0 commit comments

Comments
 (0)