Created
November 17, 2020 19:05
-
-
Save zzeroo/332ed0e493c34230c7415b07fa1de418 to your computer and use it in GitHub Desktop.
Helper .nsi script to extract information from Rust's Cargo.toml
This file contains hidden or 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
; CargoAttributes.nsi | |
; | |
; * Copyright © 2020 Stefan Müller <[email protected]> | |
; * | |
; * SPDX-License-Identifier: GPL-2.0-or-later | |
; | |
; Helper .nsi script to extract information from Rust's Cargo.toml. | |
; | |
; # Usage | |
; | |
; Put this file aside your nsi script and add the following to your main script: | |
; | |
; !makensis "CargoAttributes.nsi" | |
; !system "CargoAttributes.exe" | |
; !system "CargoAttributes.sh" | |
; !include "CargoAttributes.txt" | |
; ; optional cleanup | |
; !delfile "CargoAttributes.exe" | |
; !delfile "CargoAttributes.sh" | |
; !delfile "CargoAttributes.txt" | |
!include "TextFunc.nsh" | |
Unicode true | |
OutFile CargoAttributes.exe | |
SilentInstall silent | |
RequestExecutionLevel user | |
Section | |
${ConfigRead} Cargo.toml "name =" $R1 | |
${ConfigRead} Cargo.toml "version =" $R2 | |
## Write it to a !define for use in main script | |
FileOpen $R0 "$EXEDIR\CargoAttributes.txt" w | |
FileWrite $R0 '!define CARGO_PKG_NAME $R1$\r$\n' | |
FileWrite $R0 '!define CARGO_PKG_VERSION $R2' | |
FileClose $R0 | |
SectionEnd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment