Skip to content

Commit 2866631

Browse files
committed
Updated downloadProject to use storage.list instead of storage.listFilePaths.
1 parent b0a2b2f commit 2866631

File tree

2 files changed

+4
-13
lines changed

2 files changed

+4
-13
lines changed

src/storage/names.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -137,15 +137,6 @@ export function snakeCaseToPascalCase(snakeCaseName: string): string {
137137
return pascalCaseName;
138138
}
139139

140-
/**
141-
* Returns a regex pattern that matches all file paths in the given project.
142-
*/
143-
// TODO(lizlooney): remove this.
144-
export function makeFilePathRegexPattern(projectName: string): string {
145-
return '^/projects/' + escapeRegExp(projectName) + '/' +
146-
'.*' + escapeRegExp(JSON_FILE_EXTENSION) + '$';
147-
}
148-
149140
/**
150141
* Escapes the given text so it can be used literally in a regular expression.
151142
*/

src/storage/project.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -413,12 +413,12 @@ export function findModuleByModulePath(project: Project, modulePath: string): st
413413
*/
414414
export async function downloadProject(
415415
storage: commonStorage.Storage, projectName: string): Promise<string> {
416-
const filePaths: string[] = await storage.listFilePaths(
417-
storageNames.makeFilePathRegexPattern(projectName));
416+
const fileNames: string[] = await storage.list(
417+
storageNames.makeProjectDirectoryPath(projectName));
418418

419419
const fileNameToFileContentText: {[fileName: string]: string} = {}; // value is file content text
420-
for (const filePath of filePaths) {
421-
const fileName = storageNames.getFileName(filePath);
420+
for (const fileName of fileNames) {
421+
const filePath = storageNames.makeFilePath(projectName, fileName);
422422
const fileContentText = await storage.fetchFileContentText(filePath);
423423
fileNameToFileContentText[fileName] = fileContentText;
424424
}

0 commit comments

Comments
 (0)