Expand description

A/B Street organizes data files in a particular way. This crate implements methods to find files and (mostly) treat them the same way on native and web.

Modules

Generate paths for different A/B Street files

Normal file IO using the filesystem

Structs

A single city is identified using this.

Player-chosen groups of files to opt into downloading

A single file

A list of all canonical data files for A/B Street that’re uploaded somewhere. The file formats are tied to the latest version of the git repo. Players use the updater crate to sync these files with local copies.

A single map is identified using this.

Functions

Idempotent

Downloads bytes from a URL. This must be called with a tokio runtime somewhere. The caller creates an mpsc channel pair and provides the sender. Progress will be described through it.

Download a file from a URL. This must be called with a tokio runtime somewhere. Progress will be printed to STDOUT.

Keeps file extensions

Performs an HTTP GET request and returns the raw response. Unlike the variations in download.rs, no progress – but it works on native and web.

Performs an HTTP POST request and returns the response.

Just list all things from a directory, return sorted by name, with file extension removed.

Returns full paths

Load all serialized things from a directory, return sorted by name, with file extension removed. Detects JSON or binary. Filters out broken files.

May be a JSON or binary file. Panics on failure.

Extract the map and scenario name from a path. Crashes if the input is strange.

Print download progress to STDOUT. Pass this the receiver, then call download_to_file or download_bytes with the sender.

May be a JSON or binary file

An adapter for widgetry::Settings::read_svg to read SVGs using this crate’s methods for finding and reading files in different environments.

Returns path on success