MCPcopy Create free account
hub / github.com/FastLED/FastLED / asset

Function asset

src/fl/asset/asset.h:128–132  ·  view source on GitHub ↗

Construct an asset handle from a relative sketch path at runtime. For **compile-time rejection** of `..` paths, use the `FL_ASSET()` macro instead — it wraps this function with `FL_STATIC_ASSERT`. This overload accepts any `const char*` (including runtime-computed pointers) and, for safety, returns an empty handle if the path contains a `..` segment. Runtime resolution also refuses to walk past

Source from the content-addressed store, hash-verified

126/// a `..` segment. Runtime resolution also refuses to walk past `data/`, so
127/// this is defense-in-depth rather than the primary gate.
128constexpr asset_ref asset(const char* path) FL_NOEXCEPT {
129 return asset_detail::path_has_parent_segment(path)
130 ? asset_ref()
131 : asset_ref(path, asset_detail::clen(path));
132}
133
134/// Preferred entry point: rejects `..` at compile time via `FL_STATIC_ASSERT`.
135///

Callers 1

FL_TEST_FILEFunction · 0.85

Calls 3

path_has_parent_segmentFunction · 0.85
asset_refClass · 0.85
clenFunction · 0.85

Tested by

no test coverage detected