MCPcopy Create free account
hub / github.com/ChrisFeldmeier/OpenCodeRust / get_paths

Function get_paths

crates/opencode-server/src/routes.rs:4317–4339  ·  view source on GitHub ↗
(Query(params): Query<PathQuery>)

Source from the content-addressed store, hash-verified

4315}
4316
4317async fn get_paths(Query(params): Query<PathQuery>) -> Result<Json<PathsResponse>> {
4318 let home = dirs::home_dir()
4319 .map(|p| p.to_string_lossy().to_string())
4320 .unwrap_or_default();
4321 let config = dirs::config_dir()
4322 .map(|p| p.to_string_lossy().to_string())
4323 .unwrap_or_default();
4324 let state = dirs::data_dir()
4325 .map(|p| p.to_string_lossy().to_string())
4326 .unwrap_or_default();
4327 let cwd = std::env::current_dir()
4328 .map(|p| p.to_string_lossy().to_string())
4329 .unwrap_or_default();
4330 let worktree = params.directory.as_deref().unwrap_or(&cwd).to_string();
4331 let directory = worktree.clone();
4332 Ok(Json(PathsResponse {
4333 home,
4334 state,
4335 config,
4336 worktree,
4337 directory,
4338 }))
4339}
4340
4341#[derive(Debug, Deserialize)]
4342struct PathQuery {

Callers

nothing calls this directly

Calls 2

home_dirFunction · 0.85
cloneMethod · 0.45

Tested by

no test coverage detected