4
4
import java .net .URL ;
5
5
import org .apache .commons .io .FileUtils ;
6
6
7
- import net .lingala .zip4j .core .ZipFile ;
8
- import net .lingala .zip4j .exception .ZipException ;
9
-
10
7
class LocalBinary {
11
8
12
9
String http_path ;
@@ -24,22 +21,22 @@ class LocalBinary {
24
21
initialize ();
25
22
getBinary ();
26
23
}
27
-
24
+
28
25
void initialize (){
29
26
osname = System .getProperty ("os.name" );
30
27
arch = System .getProperty ("os.arch" );
31
28
32
29
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" ;
34
31
35
32
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 " ;
37
34
38
35
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" ;
40
37
41
38
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" ;
43
40
}
44
41
45
42
Boolean getBinary () throws Exception {
@@ -86,11 +83,11 @@ Boolean downloadBinary(String dest_parent_dir) throws LocalException{
86
83
new File (dest_parent_dir ).mkdirs ();
87
84
88
85
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" ;
90
88
File f = new File (source );
91
89
FileUtils .copyURLToFile (url , f );
92
90
93
- unzipFile (source , dest_parent_dir );
94
91
changePermissions (binary_path );
95
92
96
93
return true ;
@@ -99,16 +96,6 @@ Boolean downloadBinary(String dest_parent_dir) throws LocalException{
99
96
throw new LocalException ("Error trying to download BrowserStackLocal binary" );
100
97
}
101
98
}
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
- }
112
99
113
100
void changePermissions (String path ){
114
101
File f = new File (path );
0 commit comments