Files
RadioPlayer/tools/copy-binaries.js
2025-12-31 10:37:35 +01:00

37 lines
981 B
JavaScript

#!/usr/bin/env node
import fs from 'fs';
import path from 'path';
const repoRoot = process.cwd();
const binariesDir = path.join(repoRoot, 'src-tauri', 'binaries');
// Existing filename and expected name (Windows x86_64 triple)
const existing = 'radiocast-sidecar-x86_64-pc-windows-msvc.exe';
const expected = 'RadioPlayer-x86_64-pc-windows-msvc.exe';
const src = path.join(binariesDir, existing);
const dst = path.join(binariesDir, expected);
try {
if (!fs.existsSync(binariesDir)) {
console.warn('binaries directory not found, skipping copy');
process.exit(0);
}
if (!fs.existsSync(src)) {
console.warn(`Source binary not found: ${src}. Skipping copy.`);
process.exit(0);
}
if (fs.existsSync(dst)) {
console.log(`Expected binary already present: ${dst}`);
process.exit(0);
}
fs.copyFileSync(src, dst);
console.log(`Copied ${existing} -> ${expected}`);
} catch (e) {
console.error('Failed to copy binary:', e);
process.exit(1);
}