删除了项目选择路径时提示选择老路径
This commit is contained in:
@@ -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
Reference in New Issue
Block a user