blob: de5346a33512a4fe692c0b369b238d44a0ccff29 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
import { execFileSync } from 'node:child_process';
import { copyFileSync, mkdirSync } from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
const root = fileURLToPath(new URL('..', import.meta.url));
const target = execFileSync('rustc', ['--print', 'host-tuple'], { encoding: 'utf8' }).trim();
const extension = process.platform === 'win32' ? '.exe' : '';
const source = path.resolve(process.argv[2] || path.join(root, '..', 'build', `cpsc${extension}`));
const destination = path.join(root, 'src-tauri', 'binaries', `cpsc-${target}${extension}`);
mkdirSync(path.dirname(destination), { recursive: true });
copyFileSync(source, destination);
console.log(`Bundled compiler: ${source}`);
|