nimbus_fml/client/
config.rs

1/* This Source Code Form is subject to the terms of the Mozilla Public
2* License, v. 2.0. If a copy of the MPL was not distributed with this
3* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5use std::collections::HashMap;
6
7use crate::util::loaders::LoaderConfig;
8
9#[derive(Debug, Default)]
10pub struct FmlLoaderConfig {
11    pub cache: Option<String>,
12    pub refs: HashMap<String, String>,
13    pub ref_files: Vec<String>,
14}
15
16impl From<FmlLoaderConfig> for LoaderConfig {
17    fn from(value: FmlLoaderConfig) -> Self {
18        let cwd = std::env::current_dir().expect("Current Working Directory is not set");
19        let cache = value.cache.map(|v| cwd.join(v));
20        Self {
21            cwd,
22            refs: value.refs.into_iter().collect(),
23            repo_files: value.ref_files,
24            cache_dir: cache,
25        }
26    }
27}