删除了项目选择路径时提示选择老路径
This commit is contained in:
@@ -1080,29 +1080,30 @@ class ConfigPanel {
|
|||||||
}
|
}
|
||||||
async selectProjectPath(projectId, projectName) {
|
async selectProjectPath(projectId, projectName) {
|
||||||
try {
|
try {
|
||||||
const choice = await vscode.window.showQuickPick([
|
const pathInput = await vscode.window.showInputBox({
|
||||||
{
|
prompt: '请输入项目存储路径(绝对路径,系统将自动创建该文件夹)',
|
||||||
label: '$(folder) 选择现有文件夹',
|
placeHolder: `/path/to/your/project/${projectName}`,
|
||||||
description: '从文件系统中选择已存在的文件夹',
|
validateInput: (value) => {
|
||||||
value: 'select'
|
if (!value)
|
||||||
},
|
return '路径不能为空';
|
||||||
{
|
return null;
|
||||||
label: '$(new-folder) 创建新文件夹',
|
|
||||||
description: '输入新文件夹路径(将自动创建)',
|
|
||||||
value: 'create'
|
|
||||||
}
|
}
|
||||||
], {
|
|
||||||
placeHolder: '选择项目存储方式'
|
|
||||||
});
|
});
|
||||||
if (!choice) {
|
if (pathInput) {
|
||||||
return null;
|
try {
|
||||||
}
|
const dirUri = vscode.Uri.file(pathInput);
|
||||||
if (choice.value === 'select') {
|
await vscode.workspace.fs.createDirectory(dirUri); // 自动创建目录
|
||||||
return await this.selectExistingProjectPath(projectId, projectName);
|
this.projectService.setProjectPath(projectId, pathInput); // 保存路径
|
||||||
}
|
vscode.window.showInformationMessage(`项目存储位置已创建: ${pathInput}`);
|
||||||
else {
|
await this.saveCurrentProjectData();
|
||||||
return await this.createNewProjectPath(projectId, projectName);
|
return pathInput;
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
vscode.window.showErrorMessage(`创建目录失败: ${error}`);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
vscode.window.showErrorMessage(`选择存储路径时出错: ${error}`);
|
vscode.window.showErrorMessage(`选择存储路径时出错: ${error}`);
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "dsc-platform",
|
"name": "dsc-platform",
|
||||||
"displayName": "数字卫星构建平台",
|
"displayName": "数字卫星构建平台",
|
||||||
"version": "1.6.2",
|
"version": "1.6.4",
|
||||||
"publisher": "njust-micro-nano-lab",
|
"publisher": "njust-micro-nano-lab",
|
||||||
"description": "一个用于快速构建数字卫星的平台",
|
"description": "一个用于快速构建数字卫星的平台",
|
||||||
"repository": {
|
"repository": {
|
||||||
|
|||||||
@@ -1350,40 +1350,36 @@ export class ConfigPanel {
|
|||||||
|
|
||||||
private async selectProjectPath(projectId: string, projectName: string): Promise<string | null> {
|
private async selectProjectPath(projectId: string, projectName: string): Promise<string | null> {
|
||||||
try {
|
try {
|
||||||
const choice = await vscode.window.showQuickPick(
|
const pathInput = await vscode.window.showInputBox({
|
||||||
[
|
prompt: '请输入项目存储路径(绝对路径,系统将自动创建该文件夹)',
|
||||||
{
|
placeHolder: `/path/to/your/project/${projectName}`,
|
||||||
label: '$(folder) 选择现有文件夹',
|
validateInput: (value) => {
|
||||||
description: '从文件系统中选择已存在的文件夹',
|
if (!value) return '路径不能为空';
|
||||||
value: 'select'
|
return null;
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '$(new-folder) 创建新文件夹',
|
|
||||||
description: '输入新文件夹路径(将自动创建)',
|
|
||||||
value: 'create'
|
|
||||||
}
|
|
||||||
],
|
|
||||||
{
|
|
||||||
placeHolder: '选择项目存储方式'
|
|
||||||
}
|
}
|
||||||
);
|
});
|
||||||
|
|
||||||
if (!choice) {
|
if (pathInput) {
|
||||||
return null;
|
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;
|
||||||
if (choice.value === 'select') {
|
|
||||||
return await this.selectExistingProjectPath(projectId, projectName);
|
|
||||||
} else {
|
|
||||||
return await this.createNewProjectPath(projectId, projectName);
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
vscode.window.showErrorMessage(`选择存储路径时出错: ${error}`);
|
vscode.window.showErrorMessage(`选择存储路径时出错: ${error}`);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private async selectExistingProjectPath(projectId: string, projectName: string): Promise<string | null> {
|
private async selectExistingProjectPath(projectId: string, projectName: string): Promise<string | null> {
|
||||||
const result = await vscode.window.showOpenDialog({
|
const result = await vscode.window.showOpenDialog({
|
||||||
canSelectFiles: false,
|
canSelectFiles: false,
|
||||||
|
|||||||
Reference in New Issue
Block a user