44
55import * as cp from 'child_process' ;
66import * as path from 'path' ;
7+ import * as fs from "fs" ;
78import {
89 downloadAndUnzipVSCode ,
910 resolveCliPathFromVSCodeExecutablePath ,
@@ -17,12 +18,34 @@ async function main() {
1718 const vscodeExecutablePath = await downloadAndUnzipVSCode ( 'stable' ) ;
1819 const cliPath = resolveCliPathFromVSCodeExecutablePath ( vscodeExecutablePath ) ;
1920
21+ const extensions = [
22+ "xsro.vscode-dosbox"
23+ ] ;
24+
25+ const vscedosbox = path . resolve ( __dirname , "../.." , ".." , "vscode-dosbox" ) ;
26+ if ( fs . existsSync ( vscedosbox ) ) {
27+ const dirs = await fs . promises . readdir ( vscedosbox ) ;
28+ const dir = dirs . find ( val => val . includes ( `vscode-dosbox-${ process . platform } -${ process . arch } ` ) ) ;
29+ if ( dir ) {
30+ console . log ( "found " + dir ) ;
31+ extensions [ 0 ] = path . resolve ( vscedosbox , dir ) ;
32+ }
33+ }
34+
2035 // Use cp.spawn / cp.exec for custom setup
21- cp . spawnSync ( cliPath , [ '--install-extension' , 'xsro.vscode-dosbox' ] , {
36+ const p1 = cp . spawnSync ( cliPath , [ '--install-extension' , ... extensions ] , {
2237 encoding : 'utf-8' ,
2338 stdio : 'inherit'
2439 } ) ;
2540
41+ // Use cp.spawn / cp.exec for custom setup
42+ const p2 = cp . spawnSync ( cliPath , [ "--list-extensions" , "--show-versions" ] , {
43+ encoding : 'utf-8' ,
44+ stdio : 'inherit'
45+ } ) ;
46+
47+ console . log ( p1 , p2 ) ;
48+
2649 const sampleFolder = path . resolve ( __dirname , '../../samples' ) ;
2750 const launchArgs : string [ ] = [
2851 "--disable-workspace-trust" ,
0 commit comments