mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-26 01:25:38 -05:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user