Variables
Most of the manifest properties (other than the [application]
section) support injection of variables provided by cargo-nw
during the integration process.
cargo-nw
offers a set of internal variables created in the context of the ongoing integration combined with environment variables available at the time of execution.
Internal variables are:
$SOURCE
- source project folder (specified in the manifest bypackage.root
property)$TARGET
- destination folder (target application folder) - defaulttarget/nw/build/$NAME-$VERSION/
$OUTPUT
- redistributable output folder - default:target/nw/setup/
$TEMP
- temporary folder (located inside of thetarget/
folder) used by cargo-nw to store temporary information. This is not a system temp folder.$PLATFORM
operating system platform (windows
,linux
ormacos
)$ARCH
operating system architecture (ia32
orx64
)$NAME
- manifestapplication.name
value$TITLE
- manifestapplication.title
value$VERSION
manifestapplication.version
value$ORGANIZATION
- manifestapplication.organization
value$SHORT
- manifestdescription.short
value$LONG
- manifestdescription.long
value$AUTHORS
- manifestapplication.authors
value$COPYRIGHT
- manifestapplication.copyright
value$TRADEMARKS
- manifestapplication.trademark
value$EULA
- manifestapplication.eula
value$URL
- manifestapplication.url
value$EXE
-".exe"
on Windows and""
on unix$BAT
-".bat"
on Windows and""
on unix$CMD
-".cmd"
on Windows and""
on unix$PS1
-".ps1"
on Windows and""
on unix$SH
-""
on Windows and".sh"
on unix
$EXE
variable can be used to construct a binary filename where the filename on unix family of platforms may not have a filename extension, while on windows the extension may be .exe
, as such specifying cmd = "my-app$EXE"
will result in my-app.exe
on Windows and my-app
on unix.
Similarly, if you have a bash build script with an extension .sh
and a PowerShell script with an extension .ps1
you can construct a filename my-file$SH$PS1
that will result in my-file.ps1
on unix and my-file.sh
on unix.
In addition, environment variables available at the execution time of the cargo-nw
are also available. As such, you can specify custom variables when running cargo-nw
as follows:
MYVAR="ALPHA" cargo nw my-app.toml build all
Where the manifest file can use $MYVAR
to spply options to internal actions, resource strings etc. For example:
[[action]]
items = [
{ run = { cmd = "myproc $HOME $MYVAR" }}
]