Jazz2::Editor::WebFileBridge struct

Moves files between the level editor and the computer the browser runs on.

The web build has no files of the user, a level is opened by uploading it — the browser asks for a file, which is copied into the memory of the game — and saved by downloading it. What the editor keeps by itself, the settings and the copies of unsaved changes, is kept in the storage of the browser (see Death::IO::FileSystem::MountAsPersistent()).

Public static functions

static void PickFile(StringView extensions, Function<void(StringView)>&& onPicked)
Asks the browser for a file of one of the extensions, as .j2l;.j2t.
static auto DownloadFile(StringView path) -> bool
Gives the browser a file to save to the computer, by the name it has.
static void Update()
Passes the files picked since the last call on, call it every frame.

Function documentation

static void Jazz2::Editor::WebFileBridge::PickFile(StringView extensions, Function<void(StringView)>&& onPicked)

Asks the browser for a file of one of the extensions, as .j2l;.j2t.

The file is copied to a temporary place and onPicked gets its path, in a frame later. Nothing happens if the user doesn't choose any.