add install_root in instance
This commit is contained in:
@@ -82,10 +82,8 @@ pub fn files_to_install_mod(
|
|||||||
|
|
||||||
let files = match determain_mod_kind(mod_to_install, &mod_location)? {
|
let files = match determain_mod_kind(mod_to_install, &mod_location)? {
|
||||||
ModKind::Fomod(xml_path) => install_fomod(instance, xml_path, &mod_location)?,
|
ModKind::Fomod(xml_path) => install_fomod(instance, xml_path, &mod_location)?,
|
||||||
ModKind::EmbeddedData(data_path) => {
|
ModKind::EmbeddedData(_data_path) => install_from_dir(mod_to_install, mod_location)?,
|
||||||
install_from_dir(mod_to_install, mod_location.join(data_path))?
|
ModKind::Root => install_root(mod_to_install, mod_location)?,
|
||||||
}
|
|
||||||
ModKind::Root => install_from_dir(mod_to_install, mod_location)?,
|
|
||||||
ModKind::Unkown => install_from_dir_to_data(mod_to_install, mod_location)?,
|
ModKind::Unkown => install_from_dir_to_data(mod_to_install, mod_location)?,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -149,6 +147,22 @@ fn install_from_dir(
|
|||||||
) -> anyhow::Result<Vec<ModFile>> {
|
) -> anyhow::Result<Vec<ModFile>> {
|
||||||
let glob_filter = create_glob_filter(mod_config.ignore())?;
|
let glob_filter = create_glob_filter(mod_config.ignore())?;
|
||||||
|
|
||||||
|
let files: Vec<_> = walk_all_files(&mod_location)?
|
||||||
|
.map(|entry| entry.path().strip_prefix(&mod_location).unwrap().to_owned())
|
||||||
|
.filter(|rel_path| !glob_filter.is_match(rel_path))
|
||||||
|
.filter(|rel_path| should_be_included(rel_path))
|
||||||
|
.map(|rel_path| ModFile::new(&rel_path, &rel_path, 0))
|
||||||
|
.collect();
|
||||||
|
|
||||||
|
Ok(files)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn install_root(
|
||||||
|
mod_config: &ModConfig,
|
||||||
|
mod_location: impl AsRef<Path>,
|
||||||
|
) -> anyhow::Result<Vec<ModFile>> {
|
||||||
|
let glob_filter = create_glob_filter(mod_config.ignore())?;
|
||||||
|
|
||||||
let files: Vec<_> = walk_all_files(&mod_location)?
|
let files: Vec<_> = walk_all_files(&mod_location)?
|
||||||
.map(|entry| entry.path().strip_prefix(&mod_location).unwrap().to_owned())
|
.map(|entry| entry.path().strip_prefix(&mod_location).unwrap().to_owned())
|
||||||
.filter(|rel_path| !glob_filter.is_match(rel_path))
|
.filter(|rel_path| !glob_filter.is_match(rel_path))
|
||||||
|
|||||||
Reference in New Issue
Block a user