Prioritize 7z in PATH, fix invalid escape sequence

This commit is contained in:
CorpNewt 2024-03-01 22:24:06 -06:00 committed by GitHub
parent e7a071dfbe
commit c01e345f33
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 2 deletions

View File

@ -131,7 +131,9 @@ class WinUSB:
return os.path.exists(os.path.join(self.s_path, self.dd_name))
def check_7z(self):
self.z_path = self.z_path64 if os.path.exists(self.z_path64) else self.z_path32 if os.path.exists(self.z_path32) else None
# Check the PATH var first
z_path = self.r.run({"args":["where.exe","7z.exe"]})[0].split("\n")[0].rstrip("\r")
self.z_path = next((x for x in (z_path,self.z_path64,self.z_path32) if x and os.path.isfile(x)),None)
if self.z_path:
return True
print("Didn't locate {} - downloading...".format(self.z_name))
@ -444,7 +446,7 @@ class WinUSB:
args = [
os.path.join(self.s_path, self.dd_name),
"if={}".format(image),
"of=\\\\?\\Device\Harddisk{}\Partition2".format(disk.get("index",-1)),
"of=\\\\?\\Device\\Harddisk{}\\Partition2".format(disk.get("index",-1)),
"bs=8M",
"--progress"
]