andorid app
This commit is contained in:
@@ -19,14 +19,26 @@ if (!fs.existsSync(iconPath)) {
|
||||
|
||||
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');
|
||||
// Prefer local installed binary (node_modules/.bin) to avoid relying on npx.
|
||||
// On Windows, npm typically creates a .cmd shim, which Node can execute.
|
||||
const binDir = path.join(repoRoot, 'node_modules', '.bin');
|
||||
const localCandidates = process.platform === 'win32'
|
||||
? [
|
||||
path.join(binDir, 'rcedit.cmd'),
|
||||
path.join(binDir, 'rcedit.exe'),
|
||||
path.join(binDir, 'rcedit'),
|
||||
]
|
||||
: [path.join(binDir, 'rcedit')];
|
||||
|
||||
const localBin = localCandidates.find(p => fs.existsSync(p));
|
||||
|
||||
let cmd, args;
|
||||
if (fs.existsSync(localBin)) {
|
||||
if (localBin) {
|
||||
cmd = localBin;
|
||||
args = [exePath, '--set-icon', iconPath];
|
||||
} else {
|
||||
// fallback to npx
|
||||
// Fallback to npx. Note: Node can't execute PowerShell shims (npx.ps1), so this may fail
|
||||
// in environments that only provide .ps1 launchers.
|
||||
cmd = 'npx';
|
||||
args = ['rcedit', exePath, '--set-icon', iconPath];
|
||||
}
|
||||
@@ -35,7 +47,8 @@ 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.');
|
||||
console.error('Ensure rcedit is installed and available as a .cmd/.exe in node_modules/.bin (run `npm install`).');
|
||||
console.error('If you rely on npx, make sure you have npx.cmd on PATH (PowerShell-only shims like npx.ps1 will not work with Node spawn).');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user