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
use std::path::PathBuf;

use crate::instance::Instance;

impl Instance {
    /// Path to the instance.
    /// This path contains the version data JSON and the .minecraft folder.
    pub fn instance_path(&self) -> PathBuf {
        PathBuf::from(&self.instance_path)
    }

    /// 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 game libraries.
    /// Path can be shared with other instances of same/different version..
    pub fn libraries_path(&self) -> PathBuf {
        PathBuf::from(&self.libraries_path)
    }

    /// Path to the game assets.
    pub fn assets_path(&self) -> PathBuf {
        PathBuf::from(&self.assets_path)
    }

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

    /// Path to the game resources.
    pub fn resources_path(&self) -> PathBuf {
        let mut path = self.assets_path();
        path.push("resources");
        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 asset index JSON file.
    pub fn asset_index_path(&self) -> PathBuf {
        let mut path = self.assets_path();
        path.push("indexes");
        path
    }

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