systemprompt_models/paths/
mod.rs1mod build;
2pub mod constants;
3mod error;
4mod storage;
5mod system;
6mod web;
7
8pub use build::BuildPaths;
9pub use constants::{cloud_container, dir_names, file_names};
10pub use error::PathError;
11pub use storage::StoragePaths;
12pub use system::SystemPaths;
13pub use web::WebPaths;
14
15use std::path::Path;
16
17use crate::profile::PathsConfig;
18use systemprompt_extension::AssetPaths;
19
20#[derive(Debug, Clone)]
21pub struct AppPaths {
22 system: SystemPaths,
23 web: WebPaths,
24 build: BuildPaths,
25 storage: StoragePaths,
26}
27
28impl AppPaths {
29 pub fn from_profile(paths: &PathsConfig) -> Result<Self, PathError> {
30 Ok(Self {
31 system: SystemPaths::from_profile(paths)?,
32 web: WebPaths::from_profile(paths),
33 build: BuildPaths::from_profile(paths),
34 storage: StoragePaths::from_profile(paths)?,
35 })
36 }
37
38 pub const fn system(&self) -> &SystemPaths {
39 &self.system
40 }
41
42 pub const fn web(&self) -> &WebPaths {
43 &self.web
44 }
45
46 pub const fn build(&self) -> &BuildPaths {
47 &self.build
48 }
49
50 pub const fn storage(&self) -> &StoragePaths {
51 &self.storage
52 }
53}
54
55impl AssetPaths for AppPaths {
56 fn storage_files(&self) -> &Path {
57 self.storage.files()
58 }
59
60 fn web_dist(&self) -> &Path {
61 self.web.dist()
62 }
63}