@@ -18,12 +18,44 @@ interface ProcessingVersion {
1818let terminal : Terminal | undefined ;
1919
2020export async function activate ( context : ExtensionContext ) {
21- // TODO: Add a launch button when a relevant file is open
2221 const config = workspace . getConfiguration ( 'processing' ) ;
2322
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' ) ) ;
2525
2626 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+
2759 exec ( binaryPath , ( error , stdout , stderr ) => {
2860 if ( error ) {
2961 console . error ( `exec error: ${ error } ` ) ;
0 commit comments