44import java .net .URL ;
55import org .apache .commons .io .FileUtils ;
66
7- import net .lingala .zip4j .core .ZipFile ;
8- import net .lingala .zip4j .exception .ZipException ;
9-
107class LocalBinary {
118
129 String http_path ;
@@ -24,22 +21,22 @@ class LocalBinary {
2421 initialize ();
2522 getBinary ();
2623 }
27-
24+
2825 void initialize (){
2926 osname = System .getProperty ("os.name" );
3027 arch = System .getProperty ("os.arch" );
3128
3229 if (osname .contains ("Mac" ) || osname .contains ("Darwin" ))
33- http_path ="https://www.browserstack .com/browserstack-local/BrowserStackLocal-darwin-x64.zip " ;
30+ http_path ="https://s3.amazonaws .com/browserStack/ browserstack-local/BrowserStackLocal-darwin-x64" ;
3431
3532 else if (osname .contains ("Windows" ))
36- http_path ="https://www.browserstack .com/browserstack-local/BrowserStackLocal-win32.zip " ;
33+ http_path ="https://s3.amazonaws .com/browserStack/ browserstack-local/BrowserStackLocal.exe " ;
3734
3835 else if (osname .contains ("Linux" ) && arch .contains ("64" ))
39- http_path ="https://www.browserstack .com/browserstack-local/BrowserStackLocal-linux-x64.zip " ;
36+ http_path ="https://s3.amazonaws .com/browserStack/ browserstack-local/BrowserStackLocal-linux-x64" ;
4037
4138 else
42- http_path ="https://www.browserstack .com/browserstack-local/BrowserStackLocal-linux-ia32.zip " ;
39+ http_path ="https://s3.amazonaws .com/browserStack/ browserstack-local/BrowserStackLocal-linux-ia32" ;
4340 }
4441
4542 Boolean getBinary () throws Exception {
@@ -86,11 +83,11 @@ Boolean downloadBinary(String dest_parent_dir) throws LocalException{
8683 new File (dest_parent_dir ).mkdirs ();
8784
8885 URL url = new URL (http_path );
89- String source = dest_parent_dir + "/Download.zip" ;
86+ String source = dest_parent_dir + "/BrowserStackLocal" ;
87+ if (osname .contains ("Windows" )) source = source + ".exe" ;
9088 File f = new File (source );
9189 FileUtils .copyURLToFile (url , f );
9290
93- unzipFile (source , dest_parent_dir );
9491 changePermissions (binary_path );
9592
9693 return true ;
@@ -99,16 +96,6 @@ Boolean downloadBinary(String dest_parent_dir) throws LocalException{
9996 throw new LocalException ("Error trying to download BrowserStackLocal binary" );
10097 }
10198 }
102-
103- void unzipFile (String source , String dest ) {
104- try {
105- ZipFile zipFile = new ZipFile (source );
106- zipFile .extractAll (dest );
107- }
108- catch (ZipException e ) {
109- e .printStackTrace ();
110- }
111- }
11299
113100 void changePermissions (String path ){
114101 File f = new File (path );
0 commit comments