@@ -4,7 +4,24 @@ import * as os from 'os';
44import { env } from 'process' ;
55import { ChildProcessByStdio , spawn } from 'child_process' ;
66import { Readable } from 'stream' ;
7- import { findNbcode } from '../lsp/utils' ;
7+
8+ const findNbcode = ( extensionPath : string ) : string => {
9+ let nbcode = os . platform ( ) === 'win32' ?
10+ os . arch ( ) === 'x64' ? 'nbcode64.exe' : 'nbcode.exe'
11+ : 'nbcode.sh' ;
12+ let nbcodePath = path . join ( extensionPath , "nbcode" , "bin" , nbcode ) ;
13+
14+ let nbcodePerm = fs . statSync ( nbcodePath ) ;
15+ if ( ! nbcodePerm . isFile ( ) ) {
16+ throw `Cannot execute ${ nbcodePath } ` ;
17+ }
18+ if ( os . platform ( ) !== 'win32' ) {
19+ fs . chmodSync ( path . join ( extensionPath , "nbcode" , "bin" , nbcode ) , "744" ) ;
20+ fs . chmodSync ( path . join ( extensionPath , "nbcode" , "platform" , "lib" , "nbexec.sh" ) , "744" ) ;
21+ fs . chmodSync ( path . join ( extensionPath , "nbcode" , "java" , "maven" , "bin" , "mvn.sh" ) , "744" ) ;
22+ }
23+ return nbcodePath ;
24+ }
825
926if ( typeof process === 'object' && process . argv0 === 'node' ) {
1027 let extension = path . join ( process . argv [ 1 ] , '..' , '..' , '..' ) ;
0 commit comments