Skip to content

Commit d94a2c9

Browse files
committed
Improve CFT and CHS downloads on Windows
1 parent 270d409 commit d94a2c9

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

seleniumbase/console_scripts/sb_install.py

+9-4
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import tarfile
4040
import urllib3
4141
import zipfile
42+
from contextlib import suppress
4243
from seleniumbase.fixtures import constants
4344
from seleniumbase.fixtures import shared_utils
4445
from seleniumbase import config as sb_config
@@ -1200,7 +1201,7 @@ def main(override=None, intel_for_uc=None, force_uc=None):
12001201
driver_path = None
12011202
driver_file = None
12021203
base_path = os.sep.join(zip_file_path.split(os.sep)[:-1])
1203-
folder_name = contents[0].split(os.sep)[0]
1204+
folder_name = contents[0].split("/")[0]
12041205
folder_path = os.path.join(base_path, folder_name)
12051206
if IS_MAC or IS_LINUX:
12061207
if (
@@ -1221,12 +1222,14 @@ def main(override=None, intel_for_uc=None, force_uc=None):
12211222
zip_file_path,
12221223
"-DestinationPath",
12231224
downloads_folder,
1225+
"-Force",
12241226
]
12251227
)
12261228
else:
12271229
zip_ref.extractall(downloads_folder)
12281230
zip_ref.close()
1229-
os.remove(zip_file_path)
1231+
with suppress(Exception):
1232+
os.remove(zip_file_path)
12301233
log_d("%sUnzip Complete!%s\n" % (c2, cr))
12311234
pr_base_path = c3 + base_path + cr
12321235
pr_sep = c3 + os.sep + cr
@@ -1240,7 +1243,7 @@ def main(override=None, intel_for_uc=None, force_uc=None):
12401243
driver_path = None
12411244
driver_file = None
12421245
base_path = os.sep.join(zip_file_path.split(os.sep)[:-1])
1243-
folder_name = contents[0].split(os.sep)[0]
1246+
folder_name = contents[0].split("/")[0]
12441247
folder_path = os.path.join(base_path, folder_name)
12451248
if IS_MAC or IS_LINUX:
12461249
if (
@@ -1261,12 +1264,14 @@ def main(override=None, intel_for_uc=None, force_uc=None):
12611264
zip_file_path,
12621265
"-DestinationPath",
12631266
downloads_folder,
1267+
"-Force",
12641268
]
12651269
)
12661270
else:
12671271
zip_ref.extractall(downloads_folder)
12681272
zip_ref.close()
1269-
os.remove(zip_file_path)
1273+
with suppress(Exception):
1274+
os.remove(zip_file_path)
12701275
log_d("%sUnzip Complete!%s\n" % (c2, cr))
12711276
pr_base_path = c3 + base_path + cr
12721277
pr_sep = c3 + os.sep + cr

0 commit comments

Comments
 (0)