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