New project: preselect the workspace, label the factory folder
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
843194b429
commit
a0c95a035c
4 files changed
+20
-3
No files matched your search
+7
-2
@@ -1830,8 +1830,13 @@ async fn list_roots(Extension(user): Extension<User>, State(app): State<AppState
|
||||
.user_roots(Some(&user.id))
|
||||
.into_iter()
|
||||
.map(|r| {
|
||||
let rel = r.strip_prefix(&ws).map(|p| p.display().to_string()).unwrap_or_default();
|
||||
json!({"path": r, "name": if rel.is_empty() { "/".to_string() } else { rel }})
|
||||
let name = match r.strip_prefix(&ws) {
|
||||
Ok(p) if p.as_os_str().is_empty() => "/".to_string(),
|
||||
Ok(p) => p.display().to_string(),
|
||||
// Outside the workspace (e.g. the factory area): show where it is, not "workspace".
|
||||
Err(_) => format!("{} (factory)", r.file_name().and_then(|n| n.to_str()).unwrap_or("")).replace(" ()", ""),
|
||||
};
|
||||
json!({"path": r, "name": name})
|
||||
})
|
||||
.collect();
|
||||
Json(json!(roots))
|
||||
|
||||
Reference in new issue
Block a user