mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-12-30 06:23:46 +03:00
33 lines
858 B
JavaScript
33 lines
858 B
JavaScript
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
/**
|
|
* 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')
|
|
|
|
let extension = ''
|
|
if (process.platform === 'win32') {
|
|
extension = '.exe'
|
|
}
|
|
|
|
async function main() {
|
|
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')
|
|
}
|
|
fs.renameSync(
|
|
`src-tauri/binaries/app${extension}`,
|
|
`src-tauri/binaries/app-${targetTriple}${extension}`
|
|
)
|
|
}
|
|
|
|
main().catch((e) => {
|
|
throw e
|
|
})
|