Skip to content

Commit a48688d

Browse files
committed
Updated copyProject to use storage.list instead of storage.listFilePaths.
1 parent 6df919e commit a48688d

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/storage/project.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -163,17 +163,15 @@ export async function renameProject(
163163
*/
164164
export async function copyProject(
165165
storage: commonStorage.Storage, projectName: string, newProjectName: string): Promise<void> {
166-
const modulePaths: string[] = await storage.listFilePaths(
167-
storageNames.makeModulePathRegexPattern(projectName));
166+
const projectFileNames: string[] = await storage.list(
167+
storageNames.makeProjectDirectoryPath(projectName));
168168

169-
for (const modulePath of modulePaths) {
170-
const className = storageNames.getClassName(modulePath);
171-
const moduleType = storageNames.getModuleType(modulePath);
172-
const newModulePath = storageNames.makeModulePath(newProjectName, className, moduleType);
173-
const moduleContentText = await storage.fetchFileContentText(modulePath);
174-
await storage.saveFile(newModulePath, moduleContentText);
169+
for (const projectFileName of projectFileNames) {
170+
const filePath = storageNames.makeFilePath(projectName, projectFileName);
171+
const newFilePath = storageNames.makeFilePath(newProjectName, projectFileName);
172+
const fileContentText = await storage.fetchFileContentText(filePath);
173+
await storage.saveFile(newFilePath, fileContentText);
175174
}
176-
await saveProjectInfo(storage, newProjectName);
177175
}
178176

179177
/**

0 commit comments

Comments
 (0)