1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
use crate::instance::Instance;
use std::path::PathBuf;

impl Instance {
    /// Path to the instance folder.
    pub fn instance_path(&self) -> PathBuf {
        self.instance_path.clone()
    }

    /// Path to the .minecraft folder.
    pub fn dot_minecraft_path(&self) -> PathBuf {
        let mut path = self.instance_path();
        path.push(".minecraft");
        path
    }

    /// Path to the libraries folder.
    pub fn libraries_path(&self) -> PathBuf {
        self.libraries_path.clone()
    }

    /// Path to the assets folder.
    pub fn assets_path(&self) -> PathBuf {
        self.assets_path.clone()
    }

    /// Path to the natives folder.
    pub fn natives_path(&self) -> PathBuf {
        let mut path = self.instance_path();
        path.push("natives");
        path
    }

    /// Path to the resources folder.
    pub fn resources_path(&self) -> PathBuf {
        let mut path = self.assets_path();
        path.push("resources");
        path
    }

    /// Path to the asset indexes folder.
    pub fn asset_indexes_path(&self) -> PathBuf {
        let mut path = self.assets_path();
        path.push("indexes");
        path
    }

    /// Path to the log configs folder.
    pub fn log_configs_path(&self) -> PathBuf {
        let mut path = self.assets_path();
        path.push("log_configs");
        path
    }

    /// Path to the version data JSON file.
    pub fn version_data_path(&self) -> PathBuf {
        let mut path = self.instance_path();
        path.push("version.json");
        path
    }

    /// Path to the version data JSON file.
    #[cfg_attr(doc_cfg, doc(cfg(feature = "fabric")))]
    #[cfg(feature = "fabric")]
    pub fn fabric_version_data_path(&self) -> PathBuf {
        let mut path = self.instance_path();
        path.push("fabric_version.json");
        path
    }
}