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

Function codebuff_project_roots

rust/crates/ccusage/src/adapter/codebuff/paths.rs:22–51  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

20}
21
22fn codebuff_project_roots() -> Result<Vec<PathBuf>> {
23 let roots = if let Ok(paths) = env::var(CODEBUFF_DATA_DIR_ENV) {
24 paths
25 .split(',')
26 .map(str::trim)
27 .filter(|path| !path.is_empty())
28 .map(PathBuf::from)
29 .collect::<Vec<_>>()
30 } else {
31 let home =
32 crate::home::home_dir().ok_or_else(|| crate::cli_error("home directory is not set"))?;
33 CHANNELS
34 .iter()
35 .map(|channel| home.join(".config").join(channel))
36 .collect()
37 };
38 let mut seen = HashSet::new();
39 let mut project_roots = Vec::new();
40 for root in roots {
41 let project_root = if root.file_name().is_some_and(|name| name == "projects") {
42 root
43 } else {
44 root.join("projects")
45 };
46 if project_root.is_dir() && seen.insert(project_root.clone()) {
47 project_roots.push(project_root);
48 }
49 }
50 Ok(project_roots)
51}

Callers 1

discover_chat_filesFunction · 0.85

Calls 3

home_dirFunction · 0.85
cli_errorFunction · 0.85
pushMethod · 0.80

Tested by

no test coverage detected