natiny_resource_mount

C
int natiny_resource_mount(const char* path, const char* key);

Adds a folder to the top of the resource search stack. Paths loaded after the call are resolved from inside that folder.

Parameters

Name Type Description
path const char* Non-empty folder path, absolute or relative to the process working directory; must not be NULL
key const char* Passphrase for an encrypted pack; NULL or "" reads unencrypted packs and is ignored for loose files

Returns

Type Description
int 1 when the folder is on the stack; 0 for an invalid path, an allocation failure or an unreadable index.pack, including with a wrong key

Example

C
if (!natiny_resource_mount("data", "my secret"))
    return 1;

NatinyResource hero = natiny_resource_load("textures/hero.png");