修复: 添加工作区验证以防止.openmcp目录创建错误
- 在getWorkspaceConnectionConfigPath()中添加工作区路径验证 - 在getWorkspaceConnectionConfig()中添加工作区路径验证 - 当没有找到工作区时抛出描述性错误 - 解决VSCode扩展尝试创建.openmcp目录时的ENOENT错误
This commit is contained in:
parent
0961f18381
commit
1b3418f15b
@ -95,6 +95,9 @@ export function getConnectionConfig() {
|
||||
*/
|
||||
export function getWorkspaceConnectionConfigPath() {
|
||||
const workspace = getWorkspacePath();
|
||||
if (!workspace) {
|
||||
throw new Error('No workspace found. Please open a folder in VSCode first.');
|
||||
}
|
||||
const configDir = fspath.join(workspace, '.openmcp');
|
||||
if (!fs.existsSync(configDir)) {
|
||||
fs.mkdirSync(configDir, { recursive: true }); // 递归创建目录
|
||||
@ -113,6 +116,9 @@ export function getWorkspaceConnectionConfig() {
|
||||
}
|
||||
|
||||
const workspace = getWorkspacePath();
|
||||
if (!workspace) {
|
||||
throw new Error('No workspace found. Please open a folder in VSCode first.');
|
||||
}
|
||||
const configDir = fspath.join(workspace, '.openmcp');
|
||||
const connectionConfig = fspath.join(configDir, CONNECTION_CONFIG_NAME);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user