store: rename file/list JSON when pack key changes
renamePack 가 manifest 정의와 약관 폴더는 새 키로 옮기면서 정작 음악·사진 목록(file/list/<key>.json)은 옛 키 파일에 남겨, 이름 변경 후 목록이 비어 보이던 버그 수정. 약관 폴더와 동일하게 fsp.rename 으로 옮기고 옛 파일이 없으면(ENOENT) 무시한다.
This commit is contained in:
@@ -206,6 +206,18 @@ export async function renamePack(oldKey: string, newKey: string, pack: PackDefin
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
if ((error as NodeJS.ErrnoException).code !== 'ENOENT') throw error
|
if ((error as NodeJS.ErrnoException).code !== 'ENOENT') throw error
|
||||||
}
|
}
|
||||||
|
// 음악·사진 목록 JSON(file/list/<key>.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 이름이 바뀌었는데 약관이
|
// 약관 폴더도 함께 이름을 바꾼다 (있는 경우만). pack 이름이 바뀌었는데 약관이
|
||||||
// 옛 폴더에 남아 있으면 인스톨러가 새 packKey 로 약관을 받지 못한다.
|
// 옛 폴더에 남아 있으면 인스톨러가 새 packKey 로 약관을 받지 못한다.
|
||||||
const oldTermsDir = path.join(manifestTermsDirPath, oldKey)
|
const oldTermsDir = path.join(manifestTermsDirPath, oldKey)
|
||||||
|
|||||||
Reference in New Issue
Block a user