MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / is_probably_utf8_text

Function is_probably_utf8_text

build.rs:345–351  ·  view source on GitHub ↗

True when `path` is a readable UTF-8 text file. Used to fail the skill bundle codegen early with a clear message when a binary support file would otherwise break `include_str!` with an opaque compile error.

(path: &Path)

Source from the content-addressed store, hash-verified

343/// bundle codegen early with a clear message when a binary support file would
344/// otherwise break `include_str!` with an opaque compile error.
345fn is_probably_utf8_text(path: &Path) -> bool {
346 match fs::read(path) {
347 Ok(bytes) => std::str::from_utf8(&bytes).is_ok(),
348 // Unreadable files fall through to include_str!'s own error.
349 Err(_) => true,
350 }
351}
352
353/// Generates `$OUT_DIR/plugin_bundle_generated.rs`: a recursive manifest of
354/// every file under `plugin/skills/` (SKILL.md *and* any `references/`,

Callers 1

generate_skill_bundleFunction · 0.85

Calls 2

is_okMethod · 0.80
readFunction · 0.50

Tested by

no test coverage detected