From 0feabc9a6f79bf3b0cf37e9c7c962226ead1413f Mon Sep 17 00:00:00 2001 From: Kim Santiago <31145923+kisantia@users.noreply.github.com> Date: Thu, 30 Mar 2023 10:01:06 -0700 Subject: [PATCH] use fsPath instead of path when calculating relative path to sqlproj (#22534) --- .../src/controllers/projectController.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/extensions/sql-database-projects/src/controllers/projectController.ts b/extensions/sql-database-projects/src/controllers/projectController.ts index df9a83be56..14cd7561b8 100644 --- a/extensions/sql-database-projects/src/controllers/projectController.ts +++ b/extensions/sql-database-projects/src/controllers/projectController.ts @@ -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));