0
0

删除了项目选择路径时提示选择老路径

This commit is contained in:
xubing
2025-12-04 10:58:17 +08:00
parent fdc68144b5
commit d50c1250c8
4 changed files with 44 additions and 47 deletions

View File

@@ -1080,29 +1080,30 @@ class ConfigPanel {
}
async selectProjectPath(projectId, projectName) {
try {
const choice = await vscode.window.showQuickPick([
{
label: '$(folder) 选择现有文件夹',
description: '从文件系统中选择已存在的文件夹',
value: 'select'
},
{
label: '$(new-folder) 创建新文件夹',
description: '输入新文件夹路径(将自动创建)',
value: 'create'
const pathInput = await vscode.window.showInputBox({
prompt: '请输入项目存储路径(绝对路径,系统将自动创建该文件夹)',
placeHolder: `/path/to/your/project/${projectName}`,
validateInput: (value) => {
if (!value)
return '路径不能为空';
return null;
}
], {
placeHolder: '选择项目存储方式'
});
if (!choice) {
return null;
}
if (choice.value === 'select') {
return await this.selectExistingProjectPath(projectId, projectName);
}
else {
return await this.createNewProjectPath(projectId, projectName);
if (pathInput) {
try {
const dirUri = vscode.Uri.file(pathInput);
await vscode.workspace.fs.createDirectory(dirUri); // 自动创建目录
this.projectService.setProjectPath(projectId, pathInput); // 保存路径
vscode.window.showInformationMessage(`项目存储位置已创建: ${pathInput}`);
await this.saveCurrentProjectData();
return pathInput;
}
catch (error) {
vscode.window.showErrorMessage(`创建目录失败: ${error}`);
return null;
}
}
return null;
}
catch (error) {
vscode.window.showErrorMessage(`选择存储路径时出错: ${error}`);

File diff suppressed because one or more lines are too long

View File

@@ -1,7 +1,7 @@
{
"name": "dsc-platform",
"displayName": "数字卫星构建平台",
"version": "1.6.2",
"version": "1.6.4",
"publisher": "njust-micro-nano-lab",
"description": "一个用于快速构建数字卫星的平台",
"repository": {

View File

@@ -1350,40 +1350,36 @@ export class ConfigPanel {
private async selectProjectPath(projectId: string, projectName: string): Promise<string | null> {
try {
const choice = await vscode.window.showQuickPick(
[
{
label: '$(folder) 选择现有文件夹',
description: '从文件系统中选择已存在的文件夹',
value: 'select'
},
{
label: '$(new-folder) 创建新文件夹',
description: '输入新文件夹路径(将自动创建)',
value: 'create'
}
],
{
placeHolder: '选择项目存储方式'
const pathInput = await vscode.window.showInputBox({
prompt: '请输入项目存储路径(绝对路径,系统将自动创建该文件夹)',
placeHolder: `/path/to/your/project/${projectName}`,
validateInput: (value) => {
if (!value) return '路径不能为空';
return null;
}
);
});
if (!choice) {
return null;
if (pathInput) {
try {
const dirUri = vscode.Uri.file(pathInput);
await vscode.workspace.fs.createDirectory(dirUri); // 自动创建目录
this.projectService.setProjectPath(projectId, pathInput); // 保存路径
vscode.window.showInformationMessage(`项目存储位置已创建: ${pathInput}`);
await this.saveCurrentProjectData();
return pathInput;
} catch (error) {
vscode.window.showErrorMessage(`创建目录失败: ${error}`);
return null;
}
}
if (choice.value === 'select') {
return await this.selectExistingProjectPath(projectId, projectName);
} else {
return await this.createNewProjectPath(projectId, projectName);
}
return null;
} catch (error) {
vscode.window.showErrorMessage(`选择存储路径时出错: ${error}`);
return null;
}
}
private async selectExistingProjectPath(projectId: string, projectName: string): Promise<string | null> {
const result = await vscode.window.showOpenDialog({
canSelectFiles: false,