use fsPath instead of path when calculating relative path to sqlproj (#22534)

This commit is contained in:
Kim Santiago
2023-03-30 10:01:06 -07:00
committed by GitHub
parent ee2e59243a
commit 0feabc9a6f

View File

@@ -1406,7 +1406,7 @@ export class ProjectsController {
// 6. add generated files to SQL project
const uriList = scriptList.filter(f => !f.fsPath.endsWith(constants.autorestPostDeploymentScriptName))
const relativePaths = uriList.map(f => path.relative(project.projectFolderPath, f.path));
const relativePaths = uriList.map(f => path.relative(project.projectFolderPath, f.fsPath));
await project.addSqlObjectScripts(relativePaths); // Add generated file structure to the project
const postDeploymentScript: vscode.Uri | undefined = this.findPostDeploymentScript(scriptList);
@@ -1599,7 +1599,7 @@ export class ProjectsController {
const scriptList: vscode.Uri[] = model.extractTarget === mssql.ExtractTarget.file ? [vscode.Uri.file(model.filePath)] : await this.generateScriptList(model.filePath); // Create a list of all the files to be added to project
const relativePaths = scriptList.map(f => path.relative(project.projectFolderPath, f.path));
const relativePaths = scriptList.map(f => path.relative(project.projectFolderPath, f.fsPath));
if (!model.sdkStyle) {
await project.addSqlObjectScripts(relativePaths); // Add generated file structure to the project
@@ -1839,7 +1839,7 @@ export class ProjectsController {
let toAdd: vscode.Uri[] = [];
result.addedFiles.forEach((f: any) => toAdd.push(vscode.Uri.file(f)));
const relativePaths = toAdd.map(f => path.relative(project.projectFolderPath, f.path));
const relativePaths = toAdd.map(f => path.relative(project.projectFolderPath, f.fsPath));
await project.addSqlObjectScripts(relativePaths);
@@ -1847,7 +1847,7 @@ export class ProjectsController {
result.deletedFiles.forEach((f: any) => toRemove.push(vscode.Uri.file(f)));
let toRemoveEntries: FileProjectEntry[] = [];
toRemove.forEach(f => toRemoveEntries.push(new FileProjectEntry(f, f.path.replace(projectPath + '\\', ''), EntryType.File)));
toRemove.forEach(f => toRemoveEntries.push(new FileProjectEntry(f, f.fsPath.replace(projectPath + '\\', ''), EntryType.File)));
toRemoveEntries.forEach(async f => await project.excludeSqlObjectScript(f.fsUri.fsPath));