MCPcopy Create free account
hub / github.com/Bloom-Engine/engine / bloom_read_file

Function bloom_read_file

native/macos/src/lib.rs:2381–2390  ·  view source on GitHub ↗
(path_ptr: *const u8)

Source from the content-addressed store, hash-verified

2379
2380#[no_mangle]
2381pub extern "C" fn bloom_read_file(path_ptr: *const u8) -> *const u8 {
2382 let path = str_from_header(path_ptr);
2383 // Always return a valid Perry string. A null pointer would NaN-box into a
2384 // string-typed JS value pointing at address 0; `.length` / `.charCodeAt`
2385 // would then segfault. Callers detect "missing file" via `data.length === 0`.
2386 match std::fs::read_to_string(path) {
2387 Ok(contents) => alloc_perry_string(&contents),
2388 Err(_) => alloc_perry_string(""),
2389 }
2390}
2391
2392// ============================================================
2393// Input injection + platform detection

Callers

nothing calls this directly

Calls 2

str_from_headerFunction · 0.85
alloc_perry_stringFunction · 0.50

Tested by

no test coverage detected