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
71
72
73
74
75
76
77
78
79
80
81
crate::ix!();

impl ArgsManagerInner {

    /**
      | Get settings file path, or return false
      | if read-write settings were disabled
      | with -nosettings.
      |
      */
    pub fn get_settings_path(&self, 
        filepath: Option<&mut Box<Path>>,
        temp:     Option<bool>) -> bool {

        let temp: bool = temp.unwrap_or(false);

        if self.is_arg_negated("-settings") {
            return false;
        }
        
        if filepath.is_some() {

            let settings: String 
            = self.get_arg("-settings",BITCOIN_SETTINGS_FILENAME);

            let p2 = match temp {
                true   => settings + ".tmp",
                false  => settings
            }.to_string();

            if let Some(filepath) = filepath {

                let mut buf = PathBuf::new();

                buf.push(std::fs::canonicalize(self.get_data_dir_net()).unwrap());
                buf.push(std::fs::canonicalize(p2).unwrap());

                *filepath = buf.into_boxed_path();
            }
        }

        true
    }

    /**
      | Get setting value.
      | 
      | Result will be null if setting was unset,
      | true if "-setting" argument was passed
      | false if "-nosetting" argument was
      | passed, and a string if a "-setting=value"
      | argument was passed.
      |
      */
    pub fn get_setting(&self, arg: &str) -> SettingsValue {

        let get_chain_name = false;

        get_setting(
            &self.settings,
            self.network.as_ref().unwrap(),
            &setting_name(arg),
            !self.use_default_section(arg),
            get_chain_name
        )
    }

    /**
      | Get list of setting values.
      |
      */
    pub fn get_settings_list(&self, arg: &str) -> Vec<SettingsValue> {
        
        get_settings_list(
            &self.settings,
            self.network.as_ref().unwrap(),
            &setting_name(arg),
            !self.use_default_section(arg)
        )
    }
}