bootstrap/core/config/toml/
install.rs1use serde::{Deserialize, Deserializer};
10
11use crate::core::config::toml::ReplaceOpt;
12use crate::core::config::{Merge, set};
13use crate::{Config, HashSet, PathBuf, define_config, exit};
14
15define_config! {
16 struct Install {
18 prefix: Option<String> = "prefix",
19 sysconfdir: Option<String> = "sysconfdir",
20 docdir: Option<String> = "docdir",
21 bindir: Option<String> = "bindir",
22 libdir: Option<String> = "libdir",
23 mandir: Option<String> = "mandir",
24 datadir: Option<String> = "datadir",
25 }
26}
27
28impl Config {
29 pub fn apply_install_config(&mut self, toml_install: Option<Install>) {
32 if let Some(install) = toml_install {
33 let Install { prefix, sysconfdir, docdir, bindir, libdir, mandir, datadir } = install;
34 self.prefix = prefix.map(PathBuf::from);
35 self.sysconfdir = sysconfdir.map(PathBuf::from);
36 self.datadir = datadir.map(PathBuf::from);
37 self.docdir = docdir.map(PathBuf::from);
38 set(&mut self.bindir, bindir.map(PathBuf::from));
39 self.libdir = libdir.map(PathBuf::from);
40 self.mandir = mandir.map(PathBuf::from);
41 }
42 }
43}