File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1018,12 +1018,34 @@ async function InitComponents(context: vscode.ExtensionContext): Promise<boolean
10181018
10191019 LogDumper . getInstance ( ) ;
10201020
1021- // chmod +x for 7za
1021+ // set exec permission for built-in tools
10221022 if ( os . platform ( ) != 'win32' ) {
1023+
1024+ const exelist : string [ ] = [
1025+ resManager . Get7za ( ) . path ,
1026+ ] ;
1027+
1028+ new File ( resManager . getUnifyBuilderExe ( ) . dir )
1029+ . GetList ( undefined , File . EXCLUDE_ALL_FILTER )
1030+ . forEach ( ( f ) => {
1031+ if ( ! f . suffix ) { // nosuffix file is an exe file
1032+ exelist . push ( f . path ) ;
1033+ }
1034+ } ) ;
1035+
10231036 try {
1024- ChildProcess . execSync ( `chmod +x "${ resManager . Get7za ( ) . path } "` ) ;
1037+ for ( const exePath of exelist ) {
1038+ try {
1039+ fs . accessSync ( exePath , fs . constants . R_OK | fs . constants . X_OK ) ;
1040+ } catch ( error ) {
1041+ const cmd = `chmod +x "${ exePath } "` ;
1042+ GlobalEvent . emit ( 'globalLog.append' , cmd ) ;
1043+ ChildProcess . execSync ( cmd ) ;
1044+ }
1045+ }
10251046 } catch ( error ) {
1026- GlobalEvent . emit ( 'msg' , ExceptionToMessage ( error , 'Error' ) ) ;
1047+ GlobalEvent . emit ( 'globalLog' , ExceptionToMessage ( error , 'Error' ) ) ;
1048+ GlobalEvent . emit ( 'globalLog.show' ) ;
10271049 }
10281050 }
10291051
You can’t perform that action at this time.
0 commit comments