All checks were successful
farmcontrol/farmcontrol-ui/pipeline/head This commit looks good
- Modified the Windows installer script to change the command for the farmcontrol URI handler from `deeplink.exe` to `bun.exe` executing `deeplink.js`, improving the handling of deep links. - Updated the build script to output `deeplink.js` instead of `deeplink.exe`, aligning with the new execution method. - Adjusted the PowerShell script to check for the presence of `deeplink.js` instead of `deeplink.exe`, ensuring the correct file is validated during the staging process. - Refined the patching script to remove references to `deeplink.exe`, streamlining the target executables for patching.
48 lines
1.3 KiB
JavaScript
48 lines
1.3 KiB
JavaScript
import { existsSync } from 'node:fs'
|
|
import path from 'node:path'
|
|
import { fileURLToPath } from 'node:url'
|
|
import rcedit from 'rcedit'
|
|
|
|
const PATCH_TARGETS = new Set(['launcher.exe'])
|
|
|
|
export async function patchWindowsBinaries(appDir) {
|
|
if (process.platform !== 'win32') {
|
|
return
|
|
}
|
|
|
|
const binDir = path.join(appDir, 'bin')
|
|
if (!existsSync(binDir)) {
|
|
throw new Error(`patch-windows-binaries: bin directory not found at ${binDir}`)
|
|
}
|
|
|
|
for (const executable of PATCH_TARGETS) {
|
|
const executablePath = path.join(binDir, executable)
|
|
if (!existsSync(executablePath)) {
|
|
console.warn(`patch-windows-binaries: skipping missing ${executablePath}`)
|
|
continue
|
|
}
|
|
|
|
try {
|
|
await rcedit(executablePath, {
|
|
'requested-execution-level': 'asInvoker'
|
|
})
|
|
console.log(`patch-windows-binaries: set asInvoker on ${executablePath}`)
|
|
} catch (error) {
|
|
console.warn(
|
|
`patch-windows-binaries: failed to patch ${executablePath}:`,
|
|
error instanceof Error ? error.message : error
|
|
)
|
|
}
|
|
}
|
|
}
|
|
|
|
if (process.argv[1] === fileURLToPath(import.meta.url)) {
|
|
const appDirArg = process.argv[2]
|
|
if (!appDirArg) {
|
|
console.error('Usage: bun scripts/patch-windows-binaries.mjs <app-dir>')
|
|
process.exit(1)
|
|
}
|
|
|
|
await patchWindowsBinaries(path.resolve(appDirArg))
|
|
}
|