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() {
|
2021-06-28 03:21:24 +03:00
|
|
|
const rustInfo = (await execa('rustc', ['-vV'])).stdout
|
|
|
|
const targetTriple = /host: (\S+)/g.exec(rustInfo)[1]
|
|
|
|
if (!targetTriple) {
|
|
|
|
console.error('Failed to determine platform target triple')
|
|
|
|
}
|
2021-06-17 04:18:24 +03:00
|
|
|
fs.renameSync(
|
2021-06-21 07:13:54 +03:00
|
|
|
`src-tauri/binaries/app${extension}`,
|
2021-06-28 03:21:24 +03:00
|
|
|
`src-tauri/binaries/app-${targetTriple}${extension}`
|
2021-06-17 04:18:24 +03:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
main().catch((e) => {
|
|
|
|
throw e
|
|
|
|
})
|