Add folder for SDK style sql projects (#17918)

* update add folder for sdk style sql projects

* fix tests

* add test for add folder to sdk style project

* handle nested folders

* update helper function name
This commit is contained in:
Kim Santiago
2021-12-16 09:35:29 -08:00
committed by GitHub
parent 7378d56bfb
commit 703a925a92
3 changed files with 208 additions and 27 deletions

View File

@@ -603,3 +603,26 @@ export function getFoldersToFile(startFolder: string, endFile: string): string[]
return folders;
}
/**
* Gets the folders between the startFolder and endFolder
* @param startFolder
* @param endFolder
* @returns array of folders between startFolder and endFolder
*/
export function getFoldersAlongPath(startFolder: string, endFolder: string): string[] {
let folders: string[] = [];
const relativePath = convertSlashesForSqlProj(endFolder.substring(startFolder.length));
const pathSegments = trimChars(relativePath, ' \\').split(constants.SqlProjPathSeparator);
let folderPath = convertSlashesForSqlProj(startFolder) + constants.SqlProjPathSeparator;
for (let segment of pathSegments) {
if (segment) {
folderPath += segment + constants.SqlProjPathSeparator;
folders.push(getPlatformSafeFileEntryPath(folderPath));
}
}
return folders;
}