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

Function load_jsonc_file

src/agents/mod.rs:1122–1127  ·  view source on GitHub ↗

Read a file and parse it as JSONC. Falls back to `json!({})` if the file is missing, unreadable, or unparseable. Use this for **read-only** paths. For install/edit paths, use [`load_jsonc_file_strict`] instead.

(path: &Path)

Source from the content-addressed store, hash-verified

1120/// Use this for **read-only** paths. For install/edit paths, use
1121/// [`load_jsonc_file_strict`] instead.
1122pub fn load_jsonc_file(path: &Path) -> serde_json::Value {
1123 let Ok(contents) = std::fs::read_to_string(path) else {
1124 return serde_json::json!({});
1125 };
1126 parse_jsonc(&contents)
1127}
1128
1129/// Load a JSONC file for **editing**. Unlike [`load_jsonc_file`], this returns
1130/// an error if the file exists but cannot be parsed after comment stripping,

Callers 11

has_tracedecayMethod · 0.85
has_tracedecayMethod · 0.85
doctor_check_settingsFunction · 0.85
has_tracedecayMethod · 0.85
uninstall_context_serverFunction · 0.85
doctor_check_settingsFunction · 0.85

Calls 1

parse_jsoncFunction · 0.85

Tested by 2