File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -9,8 +9,16 @@ const SYMBOLS_BY_SECTION_FROM_ELF = "symbolsBySectionFromElf";
99
1010// Test the analyzer with local files
1111export async function handleElf ( context : vscode . ExtensionContext , panel : vscode . WebviewPanel ) {
12- const elfPath = path . join ( context . extensionPath , 'rtthread.elf' ) ;
13- const mapPath = path . join ( context . extensionPath , 'rtthread.map' ) ;
12+
13+ // 1. 先判断是否存在工作区
14+ if ( ! vscode . workspace . workspaceFolders ) {
15+ // 提示用户打开工作区
16+ vscode . window . showErrorMessage ( '请先打开一个项目文件夹或工作区!' ) ;
17+ return ;
18+ }
19+ const projectPath = vscode . workspace . workspaceFolders ! [ 0 ] . uri . fsPath ;
20+ const elfPath = path . join ( projectPath , 'rtthread.elf' ) ;
21+ const mapPath = path . join ( projectPath , 'rtthread.map' ) ;
1422
1523 console . log ( '\n==========================================' ) ;
1624
You can’t perform that action at this time.
0 commit comments