@@ -18,12 +18,44 @@ interface ProcessingVersion {
18
18
let terminal : Terminal | undefined ;
19
19
20
20
export async function activate ( context : ExtensionContext ) {
21
- // TODO: Add a launch button when a relevant file is open
22
21
const config = workspace . getConfiguration ( 'processing' ) ;
23
22
24
- const binaryPath = context . asAbsolutePath ( join ( `install-locator-${ process . platform } ` , 'bin' , 'install-locator' ) ) ;
23
+ let binaryPath = context . asAbsolutePath ( join ( `install-locator-${ process . platform } ` , 'bin' , 'install-locator' ) ) ;
24
+ const javaPath = context . asAbsolutePath ( join ( `install-locator-${ process . platform } ` , 'bin' , 'java' ) ) ;
25
25
26
26
const versions = await new Promise < ProcessingVersion [ ] > ( ( resolve , reject ) => {
27
+ // add executable permissions to the binary
28
+ if ( process . platform !== "win32" ) {
29
+ exec ( `chmod +x ${ binaryPath } ` , ( error , stdout , stderr ) => {
30
+ if ( error ) {
31
+ console . error ( `chmod error: ${ error } ` ) ;
32
+ reject ( error ) ;
33
+ }
34
+ if ( stderr ) {
35
+ console . error ( `stderr: ${ stderr } ` ) ;
36
+ reject ( stderr ) ;
37
+ }
38
+ } ) ;
39
+
40
+ // add executable permissions to the java binary
41
+ exec ( `chmod +x ${ javaPath } ` , ( error , stdout , stderr ) => {
42
+ if ( error ) {
43
+ console . error ( `chmod error: ${ error } ` ) ;
44
+ reject ( error ) ;
45
+ }
46
+ if ( stderr ) {
47
+ console . error ( `stderr: ${ stderr } ` ) ;
48
+ reject ( stderr ) ;
49
+ }
50
+ } ) ;
51
+ } else {
52
+ // on windows we need to add the .bat to the binary path
53
+ binaryPath = `${ binaryPath } .bat` ;
54
+ }
55
+
56
+
57
+
58
+
27
59
exec ( binaryPath , ( error , stdout , stderr ) => {
28
60
if ( error ) {
29
61
console . error ( `exec error: ${ error } ` ) ;
0 commit comments