installer-rp: delete base resourcepack zip after composing final pack

The RP installer downloads a fresh copy of the base zip into its temp
dir and composes the final pack on top of it. The base zip the main
installer placed in .mc_custom/resourcepacks/ has nothing to do after
that — but it stays in the Minecraft resource-pack list as a second
entry. Delete it after the final zip is written.

Guard against the case where the user set outputPackName equal to the
base filename, which would make base path == final path; in that case
we leave it alone so we don't wipe the file we just wrote.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-18 21:28:36 +09:00
parent bf225f51e1
commit 40986bee11
3 changed files with 18 additions and 1 deletions

View File

@@ -75,6 +75,7 @@
"baseUrl": " URL: {{url}}", "baseUrl": " URL: {{url}}",
"baseReceived": "베이스 리소스팩 받음 ({{kb}} KB)", "baseReceived": "베이스 리소스팩 받음 ({{kb}} KB)",
"baseAbsent": "베이스 리소스팩 없음(resourcepackPath 빈 값) — 새 리소스팩으로 생성", "baseAbsent": "베이스 리소스팩 없음(resourcepackPath 빈 값) — 새 리소스팩으로 생성",
"baseRemoved": "베이스 리소스팩 삭제: {{path}}",
"buildingZip": "리소스팩 zip 빌드 중… ({{name}})", "buildingZip": "리소스팩 zip 빌드 중… ({{name}})",
"installComplete": "설치 완료: {{path}}", "installComplete": "설치 완료: {{path}}",
"cancelRequested": "취소 요청됨. 실행 중 프로세스 {{count}}개 중단…", "cancelRequested": "취소 요청됨. 실행 중 프로세스 {{count}}개 중단…",

View File

@@ -1,6 +1,6 @@
{ {
"name": "minecraft-music-quiz-installer", "name": "minecraft-music-quiz-installer",
"version": "0.2.4", "version": "0.2.5",
"description": "마인크래프트 음악퀴즈 간편설치기 + 관리 사이트", "description": "마인크래프트 음악퀴즈 간편설치기 + 관리 사이트",
"main": "dist/installer/main.js", "main": "dist/installer/main.js",
"scripts": { "scripts": {

View File

@@ -421,6 +421,22 @@ ipcMain.handle('rp:install:start', async (): Promise<{ resourcepackPath: string
// 2-6. %appdata%/.mc_custom/resourcepacks/ 에 배치 (위 빌드가 직접 outZipPath 에 저장) // 2-6. %appdata%/.mc_custom/resourcepacks/ 에 배치 (위 빌드가 직접 outZipPath 에 저장)
sendLog(t('log.installComplete', { path: resourcepackPath })) sendLog(t('log.installComplete', { path: resourcepackPath }))
// 2-7. 베이스 리소스팩은 우리가 임시폴더에 받아서 빌드에 이미 얹었으므로,
// 메인 설치기가 `.mc_custom/resourcepacks/<resourcepackPath>` 에 받아둔
// 원본 zip 은 MC 리소스팩 목록에 굳이 남길 필요 없다. 삭제하되, 사용자가
// outputPackName 을 base 파일명과 똑같이 둬서 우리가 방금 쓴 최종 zip 과
// 같은 경로면 그대로 둔다(우리 산출물을 지우면 안 되므로).
if (pack.resourcepackPath) {
const basePackPath = path.join(resourcepackDir, pack.resourcepackPath)
if (path.resolve(basePackPath) !== path.resolve(resourcepackPath)) {
try {
await fsp.rm(basePackPath, { force: true })
sendLog(t('log.baseRemoved', { path: basePackPath }))
} catch { /* 없으면 무시 */ }
}
}
sendProgress({ phase: 'package', message: t('progress.installComplete'), done: true }) sendProgress({ phase: 'package', message: t('progress.installComplete'), done: true })
return { resourcepackPath } return { resourcepackPath }
} finally { } finally {