qualia_client_core/
qapp_paths.rs1use crate::qapp_registry::{QAPPS_DIR, QAPP_PACKAGE_MANIFEST};
4use std::path::{Path, PathBuf};
5
6pub fn qapps_dir(storage_path: impl AsRef<Path>) -> PathBuf {
8 storage_path.as_ref().join(QAPPS_DIR)
9}
10
11pub fn ensure_qapps_dir(storage_path: impl AsRef<Path>) -> std::io::Result<PathBuf> {
13 let dir = qapps_dir(storage_path);
14 std::fs::create_dir_all(&dir)?;
15 Ok(dir)
16}
17
18pub fn resolve_active_package_dir(storage_path: impl AsRef<Path>, package_id: &str) -> PathBuf {
20 crate::qapp_install::resolve_active_package_dir(storage_path.as_ref(), package_id)
21}
22
23pub fn resolve_package_manifest_path(qapp_dir: &Path) -> Option<PathBuf> {
25 let path = qapp_dir.join(QAPP_PACKAGE_MANIFEST);
26 if path.exists() {
27 Some(path)
28 } else {
29 None
30 }
31}