cobble_core/instance/
paths.rs

1use crate::instance::Instance;
2use std::path::PathBuf;
3
4impl Instance {
5    /// Path to the instance folder.
6    pub fn instance_path(&self) -> PathBuf {
7        self.instance_path.clone()
8    }
9
10    /// Path to the .minecraft folder.
11    pub fn dot_minecraft_path(&self) -> PathBuf {
12        let mut path = self.instance_path();
13        path.push(".minecraft");
14        path
15    }
16
17    /// Path to the libraries folder.
18    pub fn libraries_path(&self) -> PathBuf {
19        self.libraries_path.clone()
20    }
21
22    /// Path to the assets folder.
23    pub fn assets_path(&self) -> PathBuf {
24        self.assets_path.clone()
25    }
26
27    /// Path to the natives folder.
28    pub fn natives_path(&self) -> PathBuf {
29        let mut path = self.instance_path();
30        path.push("natives");
31        path
32    }
33
34    /// Path to the resources folder.
35    pub fn resources_path(&self) -> PathBuf {
36        let mut path = self.assets_path();
37        path.push("resources");
38        path
39    }
40
41    /// Path to the asset indexes folder.
42    pub fn asset_indexes_path(&self) -> PathBuf {
43        let mut path = self.assets_path();
44        path.push("indexes");
45        path
46    }
47
48    /// Path to the log configs folder.
49    pub fn log_configs_path(&self) -> PathBuf {
50        let mut path = self.assets_path();
51        path.push("log_configs");
52        path
53    }
54
55    /// Path to the version data JSON file.
56    pub fn version_data_path(&self) -> PathBuf {
57        let mut path = self.instance_path();
58        path.push("version.json");
59        path
60    }
61
62    /// Path to the version data JSON file.
63    #[cfg_attr(doc_cfg, doc(cfg(feature = "fabric")))]
64    #[cfg(feature = "fabric")]
65    pub fn fabric_version_data_path(&self) -> PathBuf {
66        let mut path = self.instance_path();
67        path.push("fabric_version.json");
68        path
69    }
70}