Skip to content

Commit b0a2b2f

Browse files
committed
Updated deleteProject to use storage.list instead of storage.listFilePaths.
Removed deleteProjectInfo. (No longer used.)
1 parent a48688d commit b0a2b2f

File tree

2 files changed

+5
-20
lines changed

2 files changed

+5
-20
lines changed

src/storage/names.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -146,15 +146,6 @@ export function makeFilePathRegexPattern(projectName: string): string {
146146
'.*' + escapeRegExp(JSON_FILE_EXTENSION) + '$';
147147
}
148148

149-
/**
150-
* Returns a regex pattern that matches all module paths in the given project.
151-
*/
152-
// TODO(lizlooney): remove this.
153-
export function makeModulePathRegexPattern(projectName: string): string {
154-
return '^/projects/' + escapeRegExp(projectName) + '/' +
155-
REGEX_CLASS_NAME_PART + REGEX_MODULE_TYPE_PART + escapeRegExp(JSON_FILE_EXTENSION) + '$';
156-
}
157-
158149
/**
159150
* Escapes the given text so it can be used literally in a regular expression.
160151
*/

src/storage/project.ts

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -182,13 +182,13 @@ export async function copyProject(
182182
*/
183183
export async function deleteProject(
184184
storage: commonStorage.Storage, projectName: string): Promise<void> {
185-
const modulePaths: string[] = await storage.listFilePaths(
186-
storageNames.makeModulePathRegexPattern(projectName));
185+
const projectFileNames: string[] = await storage.list(
186+
storageNames.makeProjectDirectoryPath(projectName));
187187

188-
for (const modulePath of modulePaths) {
189-
await storage.deleteFile(modulePath);
188+
for (const projectFileName of projectFileNames) {
189+
const filePath = storageNames.makeFilePath(projectName, projectFileName);
190+
await storage.deleteFile(filePath);
190191
}
191-
await deleteProjectInfo(storage, projectName);
192192
}
193193

194194
/**
@@ -529,12 +529,6 @@ function parseProjectInfoContentText(projectInfoContentText: string): ProjectInf
529529
return projectInfo;
530530
}
531531

532-
async function deleteProjectInfo(
533-
storage: commonStorage.Storage, projectName: string): Promise<void> {
534-
const projectInfoPath = storageNames.makeProjectInfoPath(projectName);
535-
await storage.deleteFile(projectInfoPath);
536-
}
537-
538532
export async function fetchProjectInfo(
539533
storage: commonStorage.Storage, projectName: string): Promise<ProjectInfo> {
540534
const projectInfoPath = storageNames.makeProjectInfoPath(projectName);

0 commit comments

Comments
 (0)