Skip to content

Engine → Modules

module_manifest.h

The parsed manifest. Paths are relative to the module root (the manifest's directory).

Structs

File Description
module_dependency One entry of "dependencies".
module_manifest The parsed manifest. Paths are relative to the module root (the manifest's directory).

Constants

Name Type Value Description
MAX_MODULE_NAME_LENGTH inline constexpr usize 64
MODULE_MANIFEST_FILE_NAME inline constexpr std::string_view "module.json"
MODULE_MANIFEST_SCHEMA_VERSION inline constexpr u32 1

Functions

Public

decorate_binary_name

[[nodiscard]] CONJURE_API std::string decorate_binary_name(
    std::string_view baseName,
    module_platform platform);

The file name of a module binary on a platform: "game" becomes "game.dll", "libgame.so" or "libgame.dylib". Empty input yields an empty string.

is_valid_module_name

[[nodiscard]] CONJURE_API bool is_valid_module_name(
    std::string_view name) noexcept;

True for names matching [a-z0-9_.]{1,64}.

load_module_manifest

[[nodiscard]] CONJURE_API core::result<module_manifest> load_module_manifest(
    const std::filesystem::path &path);

Reads and parses a manifest file once, also past Windows' MAX_PATH; messages name its generic path. A file that cannot be read or parsed also carries the JSON reader's message, which names the path as it was opened (on Windows the extended-length form from 248 characters on). MANIFEST_NOT_FOUND when the file is missing, otherwise as parse_module_manifest().

module_binary_directory

[[nodiscard]] CONJURE_API std::filesystem::path module_binary_directory(
    const std::filesystem::path &rootDirectory,
    const binary_triplet &triplet);

<root>/bin/<platform>-<arch>-<config>: the directory module_binary_path() points into.

module_binary_path

[[nodiscard]] CONJURE_API std::filesystem::path module_binary_path(
    const module_manifest &manifest,
    const std::filesystem::path &rootDirectory,
    const binary_triplet &triplet);

<root>/bin/<platform>-<arch>-<config>/<decorated binary>, or an empty path when the manifest declares no binary.

parse_module_manifest

[[nodiscard]] CONJURE_API core::result<module_manifest> parse_module_manifest(
    std::string_view jsonText,
    std::string_view sourceName = "<memory>");

Parses and validates manifest text. sourceName is the file the text came from, used in messages together with the JSON pointer of the offending member. MANIFEST_INVALID on any JSON, schema, type or range error, for a "binary" with a directory part and for a "managed" or "content" entry that leaves the module root; INVALID_NAME for a bad name.

write_module_manifest

[[nodiscard]] CONJURE_API core::json::document write_module_manifest(
    const module_manifest &manifest,
    bool includeEditorOnly = true);

Serialises a manifest. parse_module_manifest(write(m).to_string()) equals m. Export drops "editorOnly" by passing includeEditorOnly = false.