1mod instance;
2
3#[derive(Debug)]
4pub struct Path {
5 inner: std::path::PathBuf,
6}
7
8impl Path {
9 fn new(path: std::path::PathBuf) -> Self {
10 Self { inner: path }
11 }
12
13 pub fn base(&self, path: &str) -> std::path::PathBuf {
14 self.inner.join(path)
15 }
16}
17
18impl std::ops::Deref for Path {
19 type Target = std::path::PathBuf;
20
21 fn deref(&self) -> &Self::Target {
22 &self.inner
23 }
24}
25
26impl std::fmt::Display for Path {
27 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
28 self.to_string_lossy().fmt(f)
29 }
30}
31
32pub fn base_path(str: &str) -> ayun_core::Result<std::path::PathBuf> {
33 Ok(ayun_core::app().resolve::<Path>()?.base(str))
34}