installer: Fabric 이미 설치돼 있으면 fabric-installer 재실행 건너뛰기

증상: 두 번째 설치 시도에서 fabric-installer 가
  FileSystemException: ...fabric-loader-X-Y.jar: 다른 프로세스가 파일을
  사용 중이기 때문에 프로세스가 액세스 할 수 없습니다
로 실패. 마인크래프트(또는 OS 인덱서)가 jar 핸들을 잡고 있을 때 발생.

원인: fabric-installer 는 매 실행마다 versions/<id>/<id>.jar 를
deleteIfExists 한 뒤 다시 쓰려고 한다. 이미 설치돼 있으면 굳이 다시
쓸 필요가 없다.

수정: installFabricLoader 에서 customRoot/versions/<versionId>/<versionId>.jar
와 .json 이 둘 다 존재하면 곧바로 return 하고 안내 로그만 남긴다.
This commit is contained in:
2026-05-13 23:51:13 +09:00
parent c0472bb57b
commit ea72051e43
2 changed files with 14 additions and 0 deletions

View File

@@ -255,6 +255,7 @@
"javaUsed": "Java 사용: {{path}}", "javaUsed": "Java 사용: {{path}}",
"fabricInstallStart": "Fabric 자동 설치 시작: {{mc}} / loader {{loader}} → {{dir}}", "fabricInstallStart": "Fabric 자동 설치 시작: {{mc}} / loader {{loader}} → {{dir}}",
"fabricInstallDone": "Fabric 자동 설치 완료.", "fabricInstallDone": "Fabric 자동 설치 완료.",
"fabricAlreadyInstalled": "Fabric 이미 설치돼 있어 건너뜁니다: {{id}} ({{dir}})",
"launcherProfilesMissing": "launcher_profiles.json을 찾을 수 없습니다: {{path}}", "launcherProfilesMissing": "launcher_profiles.json을 찾을 수 없습니다: {{path}}",
"javaArgsUpdated": "JVM 인수 갱신(메모리 + G1 GC 튜닝 추가): \"{{before}}\" → \"{{after}}\"", "javaArgsUpdated": "JVM 인수 갱신(메모리 + G1 GC 튜닝 추가): \"{{before}}\" → \"{{after}}\"",
"lastVersionId": "launcher_profiles 의 lastVersionId = {{id}}", "lastVersionId": "launcher_profiles 의 lastVersionId = {{id}}",

View File

@@ -1068,6 +1068,19 @@ async function installFabricLoader(pack: PackDefinition, customRoot: string): Pr
throw new Error(t('errors.fabricLoaderRequired')) throw new Error(t('errors.fabricLoaderRequired'))
} }
// 0) 이미 설치돼 있으면 건너뛴다. fabric-installer 는 매번 jar 를 지우고
// 다시 쓰려고 시도해서, 마인크래프트나 다른 프로세스가 그 파일을 잡고
// 있으면 FileSystemException 으로 실패한다. 결과 파일이 그대로 있으면
// 재실행할 필요가 없으므로 그냥 통과.
const versionId = `fabric-loader-${loaderVersion}-${pack.mcVersion}`
const versionDir = path.join(customRoot, 'versions', versionId)
const versionJar = path.join(versionDir, `${versionId}.jar`)
const versionJson = path.join(versionDir, `${versionId}.json`)
if (fs.existsSync(versionJar) && fs.existsSync(versionJson)) {
sendLog(t('log.fabricAlreadyInstalled', { id: versionId, dir: versionDir }))
return
}
// 1) 최신 fabric-installer 메타데이터 조회. // 1) 최신 fabric-installer 메타데이터 조회.
sendLog(t('log.fabricFetchInstallerList')) sendLog(t('log.fabricFetchInstallerList'))
const installerList = await fetchJson<FabricInstallerMeta[]>('https://meta.fabricmc.net/v2/versions/installer') const installerList = await fetchJson<FabricInstallerMeta[]>('https://meta.fabricmc.net/v2/versions/installer')