M5: 포터블 exe 앱 (트레이·설정 창·첫 실행 마법사) + M6 사전 기능
- app/src/main: Electron 메인(트레이 상태 아이콘, 설정 창, 단일 실행, DPAPI safeStorage, 스모크 모드), IPC(window.gvr), 파인튜닝 관리 - app/src/renderer: 설정 8개 탭 + 5단계 첫 실행 마법사 (React) - electron-builder: GameVoiceRecorder.exe, zip(폴더 포터블) + 단일 exe 포터블, 워커·리소스 포함 - 사전: 사이트에서 단어·교정 규칙 추가/삭제(/api/dictionary), 게임 패치 이름 자동 추가, 묶음별 중복 허용 + DB 마이그레이션 - 사이트 서버: 종료 시 WebSocket 먼저 끊기(재시작 멈춤 수정) + 재연결 테스트 - scripts/finetune-e2e.mts, stt-eval.mts Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
57
app/src/main/paths.ts
Normal file
57
app/src/main/paths.ts
Normal file
@@ -0,0 +1,57 @@
|
||||
import { app } from 'electron';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
|
||||
/** 개발 중 app/ 폴더 (dist/main.cjs 기준 한 단계 위) */
|
||||
export const appRoot = path.resolve(__dirname, '..');
|
||||
|
||||
export function isPortable(): boolean {
|
||||
return app.isPackaged;
|
||||
}
|
||||
|
||||
/**
|
||||
* 데이터 폴더: exe 옆 GVR-Data (포터블). 단일 exe 포터블이면 PORTABLE_EXECUTABLE_DIR 옆.
|
||||
* 쓸 수 없는 위치(Program Files 등)면 %APPDATA%\GameVoiceRecorder\GVR-Data.
|
||||
*/
|
||||
export function resolveDataDir(argDir?: string): string {
|
||||
if (argDir) return argDir;
|
||||
if (process.env.GVR_DATA_DIR) return process.env.GVR_DATA_DIR;
|
||||
if (!app.isPackaged) return path.join(appRoot, '.gvr-data');
|
||||
const base = process.env.PORTABLE_EXECUTABLE_DIR || path.dirname(process.execPath);
|
||||
const d = path.join(base, 'GVR-Data');
|
||||
try {
|
||||
fs.mkdirSync(d, { recursive: true });
|
||||
fs.accessSync(d, fs.constants.W_OK);
|
||||
return d;
|
||||
} catch {
|
||||
return path.join(app.getPath('appData'), 'GameVoiceRecorder', 'GVR-Data');
|
||||
}
|
||||
}
|
||||
|
||||
export function resourcesDir(): string {
|
||||
return app.isPackaged ? path.join(process.resourcesPath, 'gvr') : path.join(appRoot, 'resources');
|
||||
}
|
||||
|
||||
export function brandDir(): string {
|
||||
return app.isPackaged ? path.join(process.resourcesPath, 'brand') : path.join(appRoot, '..', 'assets', 'app');
|
||||
}
|
||||
|
||||
export function rendererDir(): string {
|
||||
return path.join(appRoot, 'dist', 'renderer');
|
||||
}
|
||||
|
||||
/** STT 워커 실행 방법: 배포본은 PyInstaller exe, 개발은 worker/.venv 의 파이썬 */
|
||||
export function workerCommand(): { cmd: string; args: string[]; cwd?: string } {
|
||||
if (app.isPackaged) {
|
||||
const exe = path.join(process.resourcesPath, 'worker', process.platform === 'win32' ? 'gvr-worker.exe' : 'gvr-worker');
|
||||
return { cmd: exe, args: [], cwd: path.dirname(exe) };
|
||||
}
|
||||
const wdir = path.join(appRoot, '..', 'worker');
|
||||
const py = process.env.GVR_WORKER_PYTHON || path.join(wdir, '.venv', process.platform === 'win32' ? 'Scripts\\python.exe' : 'bin/python');
|
||||
return { cmd: py, args: ['-m', 'gvr_worker'], cwd: wdir };
|
||||
}
|
||||
|
||||
/** 파인튜닝 스크립트 위치 (워커 패키지 안의 finetune/) */
|
||||
export function finetuneScriptsDir(): string {
|
||||
return app.isPackaged ? path.join(process.resourcesPath, 'worker', '_internal', 'gvr_worker', 'finetune') : path.join(appRoot, '..', 'worker', 'gvr_worker', 'finetune');
|
||||
}
|
||||
Reference in New Issue
Block a user