visually updated
This commit is contained in:
36
tools/copy-binaries.js
Normal file
36
tools/copy-binaries.js
Normal file
@@ -0,0 +1,36 @@
|
||||
#!/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);
|
||||
}
|
||||
47
tools/post-build-rcedit.js
Normal file
47
tools/post-build-rcedit.js
Normal file
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env node
|
||||
import { spawnSync } from 'child_process';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
const repoRoot = process.cwd();
|
||||
const exePath = path.join(repoRoot, 'src-tauri', 'target', 'release', 'RadioPlayer.exe');
|
||||
const iconPath = path.join(repoRoot, 'src-tauri', 'icons', 'icon.ico');
|
||||
|
||||
if (!fs.existsSync(exePath)) {
|
||||
console.warn(`RadioPlayer exe not found at ${exePath}. Skipping rcedit patch.`);
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
if (!fs.existsSync(iconPath)) {
|
||||
console.warn(`Icon not found at ${iconPath}. Skipping rcedit patch.`);
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
console.log('Patching EXE icon with rcedit...');
|
||||
|
||||
// Prefer local installed binary (node_modules/.bin/rcedit) to avoid relying on npx in some CI/envs
|
||||
const localBin = path.join(repoRoot, 'node_modules', '.bin', process.platform === 'win32' ? 'rcedit.exe' : 'rcedit');
|
||||
let cmd, args;
|
||||
if (fs.existsSync(localBin)) {
|
||||
cmd = localBin;
|
||||
args = [exePath, '--set-icon', iconPath];
|
||||
} else {
|
||||
// fallback to npx
|
||||
cmd = 'npx';
|
||||
args = ['rcedit', exePath, '--set-icon', iconPath];
|
||||
}
|
||||
|
||||
const res = spawnSync(cmd, args, { stdio: 'inherit' });
|
||||
|
||||
if (res.error) {
|
||||
console.error(`Failed to run ${cmd}:`, res.error.message);
|
||||
console.error('Ensure rcedit is installed (npm install --save-dev rcedit) or that npx is available.');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
if (res.status !== 0) {
|
||||
console.error(`rcedit exited with code ${res.status}`);
|
||||
process.exit(res.status);
|
||||
}
|
||||
|
||||
console.log('Icon patched successfully.');
|
||||
Reference in New Issue
Block a user