diff --git a/src/shared/store.ts b/src/shared/store.ts index afeb5f2..37d14ac 100644 --- a/src/shared/store.ts +++ b/src/shared/store.ts @@ -206,6 +206,18 @@ export async function renamePack(oldKey: string, newKey: string, pack: PackDefin } catch (error) { if ((error as NodeJS.ErrnoException).code !== 'ENOENT') throw error } + // 음악·사진 목록 JSON(file/list/.json)도 함께 이름을 바꾼다. 이걸 빼먹으면 + // manifest 정의는 새 키로 옮겨졌는데 정작 목록 데이터는 옛 키 파일에 남아, + // 새 packKey 로는 빈 목록만 보이고 인스톨러도 곡/사진을 받지 못한다. + const oldListFile = path.join(fileListDirPath, `${oldKey}.json`) + const newListFile = path.join(fileListDirPath, `${safeNew}.json`) + try { + await fsp.mkdir(fileListDirPath, { recursive: true }) + await fsp.rename(oldListFile, newListFile) + } catch (error) { + // 옛 목록 파일이 없으면(한 번도 저장 안 한 새 pack) 그냥 둔다. + if ((error as NodeJS.ErrnoException).code !== 'ENOENT') throw error + } // 약관 폴더도 함께 이름을 바꾼다 (있는 경우만). pack 이름이 바뀌었는데 약관이 // 옛 폴더에 남아 있으면 인스톨러가 새 packKey 로 약관을 받지 못한다. const oldTermsDir = path.join(manifestTermsDirPath, oldKey)