import path from 'node:path' import os from 'node:os' // 컴파일 후 dist/shared/paths.js → 2단계 상위가 프로젝트 루트. export const projectRoot = path.resolve(__dirname, '..', '..') export const manifestRootPath = path.join(projectRoot, 'manifest.json') export const manifestDirPath = path.join(projectRoot, 'manifest') export const manifestTermsDirPath = path.join(manifestDirPath, 'terms') export const accountFilePath = path.join(projectRoot, 'account.json') export const fileDirPath = path.join(projectRoot, 'file') export const fileListDirPath = path.join(fileDirPath, 'list') export const fileDatapacksDirPath = path.join(fileDirPath, 'datapacks') export const viewsDirPath = path.join(projectRoot, 'views') export const publicDirPath = path.join(projectRoot, 'public') /** * 사용자 환경의 "%appdata%" 디렉터리(OS별 표준 사용자 데이터 경로)를 반환. * - Windows : %APPDATA% (보통 C:\Users\\AppData\Roaming) * - macOS : ~/Library/Application Support * - Linux 등 : $XDG_CONFIG_HOME 또는 ~/.config */ export function getAppDataDir(): string { if (process.platform === 'win32') { return process.env.APPDATA || path.join(os.homedir(), 'AppData', 'Roaming') } if (process.platform === 'darwin') { return path.join(os.homedir(), 'Library', 'Application Support') } return process.env.XDG_CONFIG_HOME || path.join(os.homedir(), '.config') } /** %appdata%/.mc_custom — 음악퀴즈 관련 외부 도구/캐시 보관 디렉터리. */ export function getMcCustomDir(): string { return path.join(getAppDataDir(), '.mc_custom') } /** * %appdata%/.mc_custom/installer — 설치기가 자체적으로 다운로드해 사용하는 * 외부 바이너리(yt-dlp.exe, ffmpeg.exe 등) 보관 위치. .mc_custom 루트가 * 마인크래프트 게임 폴더(`mods/`, `resourcepacks/`, `saves/` 등)와 섞이지 * 않도록 별도 하위 폴더에 둔다. */ export function getMcCustomInstallerDir(): string { return path.join(getMcCustomDir(), 'installer') }