2021-06-17 04:18:24 +03:00
|
|
|
/**
|
|
|
|
* This script is used to rename the binary with the platform specific postfix.
|
|
|
|
* When `tauri build` is ran, it looks for the binary name appended with the platform specific postfix.
|
|
|
|
*/
|
|
|
|
|
|
|
|
const execa = require('execa')
|
|
|
|
const fs = require('fs')
|
|
|
|
|
2021-06-21 07:13:54 +03:00
|
|
|
let extension = ''
|
|
|
|
if (process.platform === 'win32') {
|
|
|
|
extension = '.exe'
|
|
|
|
}
|
|
|
|
|
2021-06-17 04:18:24 +03:00
|
|
|
async function main() {
|
|
|
|
const rustTargetInfo = JSON.parse(
|
|
|
|
(
|
|
|
|
await execa(
|
|
|
|
'rustc',
|
|
|
|
['-Z', 'unstable-options', '--print', 'target-spec-json'],
|
|
|
|
{
|
|
|
|
env: {
|
|
|
|
RUSTC_BOOTSTRAP: 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
)
|
|
|
|
).stdout
|
|
|
|
)
|
|
|
|
const platformPostfix = rustTargetInfo['llvm-target']
|
|
|
|
fs.renameSync(
|
2021-06-21 07:13:54 +03:00
|
|
|
`src-tauri/binaries/app${extension}`,
|
|
|
|
`src-tauri/binaries/app-${platformPostfix}${extension}`
|
2021-06-17 04:18:24 +03:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
main().catch((e) => {
|
|
|
|
throw e
|
|
|
|
})
|