-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
375ba09
commit c9b412d
Showing
5 changed files
with
106 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// 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. | ||
*/ | ||
import { execa } from "execa" | ||
import { existsSync, renameSync } from "fs" | ||
|
||
let extension = "" | ||
if (process.platform === "win32") { | ||
extension = ".exe" | ||
} | ||
|
||
async function main() { | ||
// get target triple for current platform | ||
const rustInfo = (await execa("rustc", ["-vV"])).stdout | ||
const targetTriple = /host: (\S+)/g.exec(rustInfo)[1] | ||
if (!targetTriple) { | ||
throw new Error("Failed to determine platform target triple") | ||
} | ||
// Rename binary if it does not already exist | ||
if (!existsSync(`public/bin/anvil-${targetTriple}`)) | ||
renameSync(`public/bin/anvil${extension}`, `public/bin/anvil-${targetTriple}${extension}`) | ||
} | ||
|
||
main().catch((e) => { | ||
throw e | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file not shown.