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.rootproperty)$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.$PLATFORMoperating system platform (windows,linuxormacos)$ARCHoperating system architecture (ia32orx64)$NAME- manifestapplication.namevalue$TITLE- manifestapplication.titlevalue$VERSIONmanifestapplication.versionvalue$ORGANIZATION- manifestapplication.organizationvalue$SHORT- manifestdescription.shortvalue$LONG- manifestdescription.longvalue$AUTHORS- manifestapplication.authorsvalue$COPYRIGHT- manifestapplication.copyrightvalue$TRADEMARKS- manifestapplication.trademarkvalue$EULA- manifestapplication.eulavalue$URL- manifestapplication.urlvalue$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" }}
]