Skip to content

Commit 8a1c106

Browse files
committed
windows changes
1 parent 23199f7 commit 8a1c106

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

browserstack/local_binary.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
class LocalBinary:
1010
def __init__(self):
1111
is_64bits = sys.maxsize > 2**32
12+
self.is_windows = False
1213
osname = platform.system()
1314
if osname == 'Darwin':
1415
self.http_path = "https://s3.amazonaws.com/browserStack/browserstack-local/BrowserStackLocal-darwin-x64"
@@ -18,7 +19,8 @@ def __init__(self):
1819
else:
1920
self.http_path = "https://s3.amazonaws.com/browserStack/browserstack-local/BrowserStackLocal-linux-ia32"
2021
else:
21-
self.http_path = "https://s3.amazonaws.com/browserStack/browserstack-local/BrowserStackLocal-win32.exe"
22+
self.is_windows = True
23+
self.http_path = "https://s3.amazonaws.com/browserStack/browserstack-local/BrowserStackLocal.exe"
2224

2325
self.ordered_paths = [
2426
os.path.join(os.path.expanduser('~'), '.browserstack'),
@@ -54,8 +56,11 @@ def download(self, chunk_size=8192, progress_hook=None):
5456
bytes_so_far = 0
5557

5658
dest_parent_dir = self.__available_dir()
59+
dest_binary_name = 'BrowserStackLocal'
60+
if self.is_windows:
61+
dest_binary_name += '.exe'
5762

58-
with open(os.path.join(dest_parent_dir, 'BrowserStackLocal'), 'wb') as local_file:
63+
with open(os.path.join(dest_parent_dir, dest_binary_name), 'wb') as local_file:
5964
while True:
6065
chunk = response.read(chunk_size)
6166
bytes_so_far += len(chunk)
@@ -71,7 +76,7 @@ def download(self, chunk_size=8192, progress_hook=None):
7176
except:
7277
return self.download(chunk_size, progress_hook)
7378

74-
final_path = os.path.join(dest_parent_dir, 'BrowserStackLocal')
79+
final_path = os.path.join(dest_parent_dir, dest_binary_name)
7580
st = os.stat(final_path)
7681
os.chmod(final_path, st.st_mode | stat.S_IXUSR)
7782
return final_path

0 commit comments

Comments
 (0)