Skip to main content

systemprompt_models/paths/
web.rs

1//! Web-asset path layout under the system root.
2//!
3//! Copyright (c) systemprompt.io — Business Source License 1.1.
4//! See <https://systemprompt.io> for licensing details.
5
6use std::path::{Path, PathBuf};
7
8use crate::profile::PathsConfig;
9
10#[derive(Debug, Clone)]
11pub struct WebPaths {
12    root: PathBuf,
13    dist: PathBuf,
14    config: PathBuf,
15    metadata: PathBuf,
16}
17
18impl WebPaths {
19    const DIST_DIR: &'static str = "dist";
20
21    pub fn from_profile(paths: &PathsConfig) -> Self {
22        let root = PathBuf::from(paths.web_path_resolved());
23        let dist = root.join(Self::DIST_DIR);
24
25        Self {
26            root,
27            dist,
28            config: PathBuf::from(paths.web_config()),
29            metadata: PathBuf::from(paths.web_metadata()),
30        }
31    }
32
33    pub fn root(&self) -> &Path {
34        &self.root
35    }
36
37    pub fn dist(&self) -> &Path {
38        &self.dist
39    }
40
41    pub fn config(&self) -> &Path {
42        &self.config
43    }
44
45    pub fn metadata(&self) -> &Path {
46        &self.metadata
47    }
48}