Application descriptor

The application descriptor is written inside the Cargo manifest.

Example

[package.metadata.whack]
id = "com.business.app"
human-name = "Business App"
framerate = "60"
files = [
    { from = "foo/bar.png", to = "qux/baz.png" },
    { from = "assets/**/*.webp", to = "assets" }
]

[package.metadata.whack.initial-window]
width = 750
height = 750

Installing files

Files can be inserted into the installation directory through the files option in the application descriptor.

[package.metadata.whack]
files = [
    { from = "foo/bar.png", to = "qux/baz.png" },
    { from = "assets/**/*.webp", to = "assets" }
]

Rules:

  1. If there is a ** or * (in left-to-right order), then the initial path components until ** or * are replaced by to.
  2. If there is no ** nor *, then to represents the final file path.

Here is an example reading installation assets:

#![allow(unused)]
fn main() {
// Vec<u8>
whack::File::new("app://path/to/file").read().await.unwrap()
// String
whack::File::new("app://path/to/file").read_utf().await.unwrap()
}

Note: Currently ./ and ../ components are only recommended in the beginning of the from pattern. Do not use ../ components in the to path. Do not use ./ components other than in the beginning of the to path.

HTML5 configuration

# HTML5 configuration
[package.metadata.whack.html5]
# The World Wide Web root (default: "/");
# that is the absolute path of the application.
# This option is only necessary when the application is served
# anywhere other than the root directory in the same domain.
wwwroot = "/"