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)]
31pub struct AppPaths {
32 system: SystemPaths,
33 web: WebPaths,
34 build: BuildPaths,
35 storage: StoragePaths,
36}
37
38impl AppPaths {
39 pub fn from_profile(paths: &PathsConfig) -> Result<Self, PathError> {
40 Ok(Self {
41 system: SystemPaths::from_profile(paths)?,
42 web: WebPaths::from_profile(paths),
43 build: BuildPaths::from_profile(paths),
44 storage: StoragePaths::from_profile(paths)?,
45 })
46 }
47
48 pub const fn system(&self) -> &SystemPaths {
49 &self.system
50 }
51
52 pub const fn web(&self) -> &WebPaths {
53 &self.web
54 }
55
56 pub const fn build(&self) -> &BuildPaths {
57 &self.build
58 }
59
60 pub const fn storage(&self) -> &StoragePaths {
61 &self.storage
62 }
63}
64
65impl AssetPaths for AppPaths {
66 fn storage_files(&self) -> &Path {
67 self.storage.files()
68 }
69
70 fn web_dist(&self) -> &Path {
71 self.web.dist()
72 }
73}