MCPcopy Create free account
hub / github.com/ccusage/ccusage / paths

Function paths

rust/crates/ccusage/src/adapter/opencode/paths.rs:5–29  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3use crate::Result;
4
5pub(super) fn paths() -> Result<Vec<PathBuf>> {
6 let mut paths = Vec::new();
7 let mut seen = HashSet::new();
8 if let Ok(env_paths) = env::var("OPENCODE_DATA_DIR") {
9 for raw in env_paths
10 .split(',')
11 .map(str::trim)
12 .filter(|path| !path.is_empty())
13 {
14 let path = PathBuf::from(raw);
15 if path.is_dir() && seen.insert(path.clone()) {
16 paths.push(path);
17 }
18 }
19 return Ok(paths);
20 }
21
22 let home =
23 crate::home::home_dir().ok_or_else(|| crate::cli_error("home directory is not set"))?;
24 let path = home.join(".local/share/opencode");
25 if path.is_dir() && seen.insert(path.clone()) {
26 paths.push(path);
27 }
28 Ok(paths)
29}

Callers 1

load_entries_innerFunction · 0.70

Calls 3

home_dirFunction · 0.85
cli_errorFunction · 0.85
pushMethod · 0.80

Tested by

no test coverage detected