diff options
| author | skal <pascal.massimino@gmail.com> | 2026-03-19 18:48:17 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-03-19 18:48:17 +0100 |
| commit | c66d33a45741eee13c57efb841769a94b577e1a9 (patch) | |
| tree | b4befbecbe9edb171ad5aaf92cad96d8cd152cad /tools | |
| parent | ba5154165378b0097a8dbc57cb3a2c74b17b271c (diff) | |
fix(assets): skip missing binary assets with warning instead of failing
asset_packer now emits a zero-size empty stub for BINARY assets whose
file is not found, and continues with a warning rather than aborting.
Allows building without optional assets like cnn_v2_weights.bin.
handoff(Gemini): asset_packer tolerates missing BINARY files; GetAsset()
returns nullptr/size=0 for those assets at runtime.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/asset_packer.cc | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/tools/asset_packer.cc b/tools/asset_packer.cc index 37d2a57..deb4de5 100644 --- a/tools/asset_packer.cc +++ b/tools/asset_packer.cc @@ -508,9 +508,16 @@ int main(int argc, char* argv[]) { } else { std::ifstream asset_file(full_path, std::ios::binary); if (!asset_file.is_open()) { - fprintf(stderr, "Error: Could not open asset file: %s\n", - full_path.c_str()); - return 1; + fprintf(stderr, + "Warning: Asset file not found, skipping: %s (%s)\n", + info.name.c_str(), full_path.c_str()); + fprintf(assets_data_cc_file, + "const size_t ASSET_SIZE_%s = 0;\n", + info.name.c_str()); + fprintf(assets_data_cc_file, + "alignas(16) static const uint8_t %s[] = {0};\n", + info.data_array_name.c_str()); + continue; } buffer.assign((std::istreambuf_iterator<char>(asset_file)), std::istreambuf_iterator<char>()); |
