Skip to content

Commit 7f062ea

Browse files
author
sunxianfu
committed
fix: 修复路径问题
1 parent d873b80 commit 7f062ea

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/utils/elf/handleElf.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,16 @@ const SYMBOLS_BY_SECTION_FROM_ELF = "symbolsBySectionFromElf";
99

1010
// Test the analyzer with local files
1111
export 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

0 commit comments

Comments
 (0)