systemprompt_models/paths/
mod.rs1pub(crate) mod build;
12pub mod constants;
13mod error;
14mod storage;
15mod system;
16mod web;
17
18pub use build::BuildPaths;
19pub use constants::{cloud_container, dir_names, file_names};
20pub use error::PathError;
21pub use storage::StoragePaths;
22pub use system::SystemPaths;
23pub use web::WebPaths;
24
25use std::path::Path;
26
27use crate::profile::PathsConfig;
28use systemprompt_extension::AssetPaths;
29
30#[derive(Debug, Clone, Copy, PartialEq, Eq)]
33pub enum PathResolution {
34 Canonicalize,
35 Lexical,
37}
38
39#[derive(Debug, Clone)]
40pub struct AppPaths {
41 system: SystemPaths,
42 web: WebPaths,
43 build: BuildPaths,
44 storage: StoragePaths,
45}
46
47impl AppPaths {
48 pub fn from_profile(
49 paths: &PathsConfig,
50 resolution: PathResolution,
51 ) -> Result<Self, PathError> {
52 Ok(Self {
53 system: SystemPaths::from_profile(paths, resolution)?,
54 web: WebPaths::from_profile(paths),
55 build: BuildPaths::from_profile(paths),
56 storage: StoragePaths::from_profile(paths)?,
57 })
58 }
59
60 pub const fn system(&self) -> &SystemPaths {
61 &self.system
62 }
63
64 pub const fn web(&self) -> &WebPaths {
65 &self.web
66 }
67
68 pub const fn build(&self) -> &BuildPaths {
69 &self.build
70 }
71
72 pub const fn storage(&self) -> &StoragePaths {
73 &self.storage
74 }
75}
76
77impl AssetPaths for AppPaths {
78 fn storage_files(&self) -> &Path {
79 self.storage.files()
80 }
81
82 fn web_dist(&self) -> &Path {
83 self.web.dist()
84 }
85}