Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | import * as fs from 'node:fs' import * as path from 'node:path' import * as vscode from 'vscode' /** * 获取当前 VS Code 工作区根目录 */ export function getCurrentWorkspaceRoot(): string { const workspaceRoot = vscode.workspace.workspaceFolders?.[0]?.uri.fsPath return workspaceRoot || '.' } /** * 获取工作区下 `.dalidev/` 目录中的数据文件路径(确保目录存在) */ export function getDataFile(workspaceRoot: string, fileName: string): string { const dataDir = path.join(workspaceRoot, '.dalidev') if (!fs.existsSync(dataDir)) { fs.mkdirSync(dataDir, { recursive: true }) } return path.join(dataDir, fileName) } |