| 53 | } |
| 54 | |
| 55 | pub async fn resolved_project_session_db_path(project_root: &Path) -> Option<PathBuf> { |
| 56 | if is_hermes_profile_home(project_root) { |
| 57 | return Some(hermes_profile_session_db_path(project_root)); |
| 58 | } |
| 59 | |
| 60 | match crate::storage::read_enrollment_marker(project_root) { |
| 61 | Ok(Some(_)) => { |
| 62 | return resolve_layout_for_current_profile(project_root) |
| 63 | .ok() |
| 64 | .map(|layout| layout.sessions_db_path); |
| 65 | } |
| 66 | Ok(None) => {} |
| 67 | Err(_) => return None, |
| 68 | } |
| 69 | if let Some(db_path) = registry_profile_session_db_path(project_root).await { |
| 70 | return Some(db_path); |
| 71 | } |
| 72 | resolve_layout_for_current_profile(project_root) |
| 73 | .ok() |
| 74 | .map(|layout| layout.sessions_db_path) |
| 75 | } |
| 76 | |
| 77 | async fn registry_profile_session_db_path(project_root: &Path) -> Option<PathBuf> { |
| 78 | let profile_root = crate::storage::default_profile_root().ok()?; |