MCPcopy Create free account
hub / github.com/GCWing/BitFun / resolve_runtime_artifact_path

Function resolve_runtime_artifact_path

src/apps/desktop/src/api/path_target.rs:80–112  ·  view source on GitHub ↗
(
    app_state: &AppState,
    raw_path: &str,
)

Source from the content-addressed store, hash-verified

78}
79
80async fn resolve_runtime_artifact_path(
81 app_state: &AppState,
82 raw_path: &str,
83) -> Result<Option<PathBuf>, String> {
84 if !is_bitfun_runtime_uri(raw_path) {
85 return Ok(None);
86 }
87
88 let parsed = parse_bitfun_runtime_uri(raw_path).map_err(|e| e.to_string())?;
89 let workspace = if parsed.workspace_scope == "current" {
90 app_state.workspace_service.get_current_workspace().await
91 } else {
92 app_state
93 .workspace_service
94 .list_workspace_infos()
95 .await
96 .into_iter()
97 .find(|workspace| workspace.id == parsed.workspace_scope)
98 }
99 .ok_or_else(|| {
100 format!(
101 "Unable to resolve runtime URI scope '{}'",
102 parsed.workspace_scope
103 )
104 })?;
105
106 let mut resolved = runtime_root_for_workspace_info(&workspace)?;
107 for segment in parsed.relative_path.split('/') {
108 resolved.push(segment);
109 }
110
111 Ok(Some(resolved))
112}
113
114async fn lookup_remote_entry_for_path(
115 app_state: &AppState,

Callers 1

Calls 6

list_workspace_infosMethod · 0.80
is_bitfun_runtime_uriFunction · 0.50
parse_bitfun_runtime_uriFunction · 0.50
get_current_workspaceMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected