feat(installer): v0.4.0 — 파일제거기, 커스텀 폴더명, 포트포워딩 개편, 이름/개발자용 표기
- 음악퀴즈 파일제거 도구 신규 추가: 동의 → 휴지통/완전삭제 선택 → 커스텀 폴더 (현재값 + 기본 .mc_custom) 전체, 데스크톱 바로가기, gameDir 가 해당 폴더인 마인크래프트 런처 프로필 정리. - MC_CUSTOM_DIR .env 로 커스텀 게임 폴더 이름 유동화(.mc_custom 기본). 렌더러 사전에도 실제 폴더명 반영. - 간편포트포워딩: 실행 중 UPnP 매핑 유지, 창 닫힘/종료 시 자동 제거(activePort 추적). - 개발자용 빌드는 창/헤더 제목 앞에 (개발자용) 표기, exe 이름에도 반영. - exe 이름 변경: 음악퀴즈 간편설치기 / 음악퀴즈 리소스팩설치기 / 간편포트포워딩. - README 및 .env 템플릿 갱신, 버전 0.3.23 → 0.4.0. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -39,9 +39,43 @@ export function getAppDataDir(): string {
|
||||
return process.env.XDG_CONFIG_HOME || path.join(os.homedir(), '.config')
|
||||
}
|
||||
|
||||
/** %appdata%/.mc_custom — 음악퀴즈 관련 외부 도구/캐시 보관 디렉터리. */
|
||||
/**
|
||||
* 커스텀 게임 디렉터리의 폴더 이름. 기본은 `.mc_custom` 이지만 환경변수
|
||||
* `MC_CUSTOM_DIR` 로 다른 이름을 지정할 수 있다(.env / .env.build 로 주입).
|
||||
* 경로 구분자·상위경로 이스케이프(`/`, `\`, `..`)는 제거해 항상 %appdata%
|
||||
* 바로 아래 단일 폴더로 강제한다.
|
||||
*/
|
||||
export function getMcCustomDirName(): string {
|
||||
const raw = (process.env.MC_CUSTOM_DIR ?? '').trim()
|
||||
if (!raw) return '.mc_custom'
|
||||
const sanitized = raw.replace(/[\\/]+/g, '').replace(/\.\.+/g, '.')
|
||||
return sanitized || '.mc_custom'
|
||||
}
|
||||
|
||||
/** %appdata%/<MC_CUSTOM_DIR|.mc_custom> — 음악퀴즈 관련 게임 폴더/외부 도구/캐시 보관 디렉터리. */
|
||||
export function getMcCustomDir(): string {
|
||||
return path.join(getAppDataDir(), '.mc_custom')
|
||||
return path.join(getAppDataDir(), getMcCustomDirName())
|
||||
}
|
||||
|
||||
/**
|
||||
* 사전/문자열 구조 안의 리터럴 `.mc_custom` 을 실제 폴더 이름으로 치환한 깊은
|
||||
* 복사본을 돌려준다. 기본값(`.mc_custom`)이면 원본을 그대로 반환한다. 렌더러로
|
||||
* 넘기는 i18n 사전에 적용해 UI 안내 문구가 실제 폴더 이름과 어긋나지 않게 한다.
|
||||
*/
|
||||
export function withCustomDirName<T>(value: T): T {
|
||||
const name = getMcCustomDirName()
|
||||
if (name === '.mc_custom') return value
|
||||
const replace = (v: unknown): unknown => {
|
||||
if (typeof v === 'string') return v.split('.mc_custom').join(name)
|
||||
if (Array.isArray(v)) return v.map(replace)
|
||||
if (v && typeof v === 'object') {
|
||||
const out: Record<string, unknown> = {}
|
||||
for (const [k, val] of Object.entries(v as Record<string, unknown>)) out[k] = replace(val)
|
||||
return out
|
||||
}
|
||||
return v
|
||||
}
|
||||
return replace(value) as T
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user