@@ -78,6 +78,39 @@ function activate(context) {
7878 }
7979 } ) ;
8080
81+ // Register individual component installation commands
82+ let installCompilerDisposable = vscode . commands . registerCommand ( 'ps1-dev-extension.installCompiler' , async function ( ) {
83+ try {
84+ await installComponent ( 'gcc' ) ;
85+ } catch ( error ) {
86+ vscode . window . showErrorMessage ( `Failed to install compiler: ${ error . message } ` ) ;
87+ }
88+ } ) ;
89+
90+ let installSDKDisposable = vscode . commands . registerCommand ( 'ps1-dev-extension.installSDK' , async function ( ) {
91+ try {
92+ await installComponent ( 'psn00b_sdk' ) ;
93+ } catch ( error ) {
94+ vscode . window . showErrorMessage ( `Failed to install SDK: ${ error . message } ` ) ;
95+ }
96+ } ) ;
97+
98+ let installEmulatorDisposable = vscode . commands . registerCommand ( 'ps1-dev-extension.installEmulator' , async function ( ) {
99+ try {
100+ await installComponent ( 'emulator' ) ;
101+ } catch ( error ) {
102+ vscode . window . showErrorMessage ( `Failed to install emulator: ${ error . message } ` ) ;
103+ }
104+ } ) ;
105+
106+ let installDebuggerDisposable = vscode . commands . registerCommand ( 'ps1-dev-extension.installDebugger' , async function ( ) {
107+ try {
108+ await installComponent ( 'gdb_multiarch_win' ) ;
109+ } catch ( error ) {
110+ vscode . window . showErrorMessage ( `Failed to install debugger: ${ error . message } ` ) ;
111+ }
112+ } ) ;
113+
81114 // Fix permissions
82115 const fixPermissionsDisposable = vscode . commands . registerCommand ( 'ps1-dev-extension.fixPermissions' , async ( ) => {
83116 await fixToolPermissions ( ) ;
@@ -88,6 +121,10 @@ function activate(context) {
88121 context . subscriptions . push ( buildProjectDisposable ) ;
89122 context . subscriptions . push ( runEmulatorDisposable ) ;
90123 context . subscriptions . push ( generateISODisposable ) ;
124+ context . subscriptions . push ( installCompilerDisposable ) ;
125+ context . subscriptions . push ( installSDKDisposable ) ;
126+ context . subscriptions . push ( installEmulatorDisposable ) ;
127+ context . subscriptions . push ( installDebuggerDisposable ) ;
91128 context . subscriptions . push ( fixPermissionsDisposable ) ;
92129}
93130
@@ -234,6 +271,26 @@ async function setupEnvironment(isManualSetup = false) {
234271 }
235272}
236273
274+ // Function to install a component
275+ async function installComponent ( componentName ) {
276+ const config = loadConfig ( ) ;
277+ const component = config . tools [ componentName ] ;
278+
279+ if ( component . installed ) {
280+ vscode . window . showInformationMessage ( `${ componentName } is already installed.` ) ;
281+ return ;
282+ }
283+
284+ const success = await downloadAndExtractTool ( componentName ) ;
285+ if ( success ) {
286+ component . installed = true ;
287+ saveConfig ( config ) ;
288+ vscode . window . showInformationMessage ( `${ componentName } installed successfully.` ) ;
289+ } else {
290+ vscode . window . showErrorMessage ( `Failed to install ${ componentName } .` ) ;
291+ }
292+ }
293+
237294// Function to create a Hello World project
238295async function createHelloWorld ( ) {
239296 // Get the workspace folder
0 commit comments