From 40986bee11df7d462245dbf4e1269596d03c41dc Mon Sep 17 00:00:00 2001 From: claude-bot Date: Mon, 18 May 2026 21:28:36 +0900 Subject: [PATCH] installer-rp: delete base resourcepack zip after composing final pack MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- locales/installer-rp/ko-kr.json | 1 + package.json | 2 +- src/installer-rp/main.ts | 16 ++++++++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/locales/installer-rp/ko-kr.json b/locales/installer-rp/ko-kr.json index dbdacea..fd927bc 100644 --- a/locales/installer-rp/ko-kr.json +++ b/locales/installer-rp/ko-kr.json @@ -75,6 +75,7 @@ "baseUrl": " URL: {{url}}", "baseReceived": "베이스 리소스팩 받음 ({{kb}} KB)", "baseAbsent": "베이스 리소스팩 없음(resourcepackPath 빈 값) — 새 리소스팩으로 생성", + "baseRemoved": "베이스 리소스팩 삭제: {{path}}", "buildingZip": "리소스팩 zip 빌드 중… ({{name}})", "installComplete": "설치 완료: {{path}}", "cancelRequested": "취소 요청됨. 실행 중 프로세스 {{count}}개 중단…", diff --git a/package.json b/package.json index 8bc70dd..2be94ef 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "minecraft-music-quiz-installer", - "version": "0.2.4", + "version": "0.2.5", "description": "마인크래프트 음악퀴즈 간편설치기 + 관리 사이트", "main": "dist/installer/main.js", "scripts": { diff --git a/src/installer-rp/main.ts b/src/installer-rp/main.ts index a66c10c..c5cbf2b 100644 --- a/src/installer-rp/main.ts +++ b/src/installer-rp/main.ts @@ -421,6 +421,22 @@ ipcMain.handle('rp:install:start', async (): Promise<{ resourcepackPath: string // 2-6. %appdata%/.mc_custom/resourcepacks/ 에 배치 (위 빌드가 직접 outZipPath 에 저장) sendLog(t('log.installComplete', { path: resourcepackPath })) + + // 2-7. 베이스 리소스팩은 우리가 임시폴더에 받아서 빌드에 이미 얹었으므로, + // 메인 설치기가 `.mc_custom/resourcepacks/` 에 받아둔 + // 원본 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 }) return { resourcepackPath } } finally {