mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-20 01:25:37 -05:00
Standardize slashes in sqlproj (#11174)
* standardize slashes that go in sqlproj * update tests to not have os specific baselines * fix test * fix delete tests * some cleanup
This commit is contained in:
@@ -311,7 +311,7 @@ export class Project {
|
||||
|
||||
private addFileToProjFile(path: string) {
|
||||
const newFileNode = this.projFileXmlDoc.createElement(constants.Build);
|
||||
newFileNode.setAttribute(constants.Include, path);
|
||||
newFileNode.setAttribute(constants.Include, utils.convertSlashesForSqlProj(path));
|
||||
|
||||
this.findOrCreateItemGroup(constants.Build).appendChild(newFileNode);
|
||||
}
|
||||
@@ -320,7 +320,7 @@ export class Project {
|
||||
const fileNodes = this.projFileXmlDoc.documentElement.getElementsByTagName(constants.Build);
|
||||
|
||||
for (let i = 0; i < fileNodes.length; i++) {
|
||||
if (fileNodes[i].getAttribute(constants.Include) === path) {
|
||||
if (fileNodes[i].getAttribute(constants.Include) === utils.convertSlashesForSqlProj(path)) {
|
||||
fileNodes[i].parentNode.removeChild(fileNodes[i]);
|
||||
return;
|
||||
}
|
||||
@@ -331,7 +331,7 @@ export class Project {
|
||||
|
||||
private addFolderToProjFile(path: string) {
|
||||
const newFolderNode = this.projFileXmlDoc.createElement(constants.Folder);
|
||||
newFolderNode.setAttribute(constants.Include, path);
|
||||
newFolderNode.setAttribute(constants.Include, utils.convertSlashesForSqlProj(path));
|
||||
|
||||
this.findOrCreateItemGroup(constants.Folder).appendChild(newFolderNode);
|
||||
}
|
||||
@@ -340,7 +340,7 @@ export class Project {
|
||||
const folderNodes = this.projFileXmlDoc.documentElement.getElementsByTagName(constants.Folder);
|
||||
|
||||
for (let i = 0; i < folderNodes.length; i++) {
|
||||
if (folderNodes[i].getAttribute(constants.Include) === path) {
|
||||
if (folderNodes[i].getAttribute(constants.Include) === utils.convertSlashesForSqlProj(path)) {
|
||||
folderNodes[i].parentNode.removeChild(folderNodes[i]);
|
||||
return;
|
||||
}
|
||||
@@ -363,7 +363,7 @@ export class Project {
|
||||
referenceNode.setAttribute(constants.Condition, constants.NetCoreCondition);
|
||||
}
|
||||
|
||||
referenceNode.setAttribute(constants.Include, isSystemDatabaseProjectEntry ? entry.fsUri.fsPath.substring(1) : entry.fsUri.fsPath); // need to remove the leading slash for system database path for build to work on Windows
|
||||
referenceNode.setAttribute(constants.Include, entry.pathForSqlProj());
|
||||
this.addDatabaseReferenceChildren(referenceNode, entry.name);
|
||||
this.findOrCreateItemGroup(constants.ArtifactReference).appendChild(referenceNode);
|
||||
this.databaseReferences.push(entry);
|
||||
@@ -372,7 +372,7 @@ export class Project {
|
||||
if (isSystemDatabaseProjectEntry) {
|
||||
let ssdtReferenceNode = this.projFileXmlDoc.createElement(constants.ArtifactReference);
|
||||
ssdtReferenceNode.setAttribute(constants.Condition, constants.NotNetCoreCondition);
|
||||
ssdtReferenceNode.setAttribute(constants.Include, (<SystemDatabaseReferenceProjectEntry>entry).ssdtUri.fsPath.substring(1)); // need to remove the leading slash for system database path for build to work on Windows
|
||||
ssdtReferenceNode.setAttribute(constants.Include, (<SystemDatabaseReferenceProjectEntry>entry).ssdtPathForSqlProj());
|
||||
this.addDatabaseReferenceChildren(ssdtReferenceNode, entry.name);
|
||||
this.findOrCreateItemGroup(constants.ArtifactReference).appendChild(ssdtReferenceNode);
|
||||
}
|
||||
@@ -548,6 +548,10 @@ export class ProjectEntry {
|
||||
public toString(): string {
|
||||
return this.fsUri.path;
|
||||
}
|
||||
|
||||
public pathForSqlProj(): string {
|
||||
return utils.convertSlashesForSqlProj(this.fsUri.path);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -567,6 +571,16 @@ class SystemDatabaseReferenceProjectEntry extends DatabaseReferenceProjectEntry
|
||||
constructor(uri: Uri, public ssdtUri: Uri, public name: string) {
|
||||
super(uri, DatabaseReferenceLocation.differentDatabaseSameServer, name);
|
||||
}
|
||||
|
||||
public pathForSqlProj(): string {
|
||||
// need to remove the leading slash for system database path for build to work on Windows
|
||||
return utils.convertSlashesForSqlProj(this.fsUri.path.substring(1));
|
||||
}
|
||||
|
||||
public ssdtPathForSqlProj(): string {
|
||||
// need to remove the leading slash for system database path for build to work on Windows
|
||||
return utils.convertSlashesForSqlProj(this.ssdtUri.path.substring(1));
|
||||
}
|
||||
}
|
||||
|
||||
export enum EntryType {
|
||||
|
||||
Reference in New Issue
Block a user