- 앱: %LOCALAPPDATA%\VALORANT\Saved 아래 <경기 ID>.vrf 를 찾아 gvr-replay.exe 로 변환, GVR-Data/replays/<경기 ID>.json.gz 로 보관 (원본 · 앱 버전이 같으면 다시 변환하지 않음) - GET /api/matches/:id/replay: gzip JSON, 처음 변환이 15초를 넘으면 202 converting, 실패 422 replay_failed(이유), 변환기 없음 500. GET /api/replays: 찾은 리플레이 목록 - 변환은 한 번에 하나, 낮은 우선순위. 실패한 파일은 다시 내려받을 때까지 다시 하지 않음 - 중계: content-encoding 이 있는 응답은 바이너리 조각으로 (gzip 이 깨지지 않게) - 사이트: 변환 중(202)이면 3초마다 다시 묻고 '변환하는 중' 표시, 변환 실패 안내 - 빌드: win-ci 가 .NET 10 SDK 로 gvr-replay.exe(단일 파일)를 만들어 resources/replay 에 넣고, 시험 리플레이로 변환기 · 포터블 앱 안 변환까지 확인 (smoke GVR_SMOKE_VRF) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
65 lines
2.8 KiB
TypeScript
65 lines
2.8 KiB
TypeScript
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');
|
|
}
|
|
|
|
/** 발로란트 리플레이 변환기 (tools/replay-extract, 배포본은 resources/replay/gvr-replay.exe) */
|
|
export function replayToolPath(): string {
|
|
if (process.env.GVR_REPLAY_TOOL) return process.env.GVR_REPLAY_TOOL;
|
|
if (app.isPackaged) return path.join(process.resourcesPath, 'replay', process.platform === 'win32' ? 'gvr-replay.exe' : 'gvr-replay');
|
|
return path.join(appRoot, '..', 'tools', 'replay-extract', 'out', process.platform === 'win32' ? 'win/gvr-replay.exe' : 'linux/gvr-replay');
|
|
}
|