add install_root in instance

This commit is contained in:
2026-03-16 23:00:18 +01:00
parent fa93cf9a6b
commit b6b3759446

View File

@@ -82,10 +82,8 @@ pub fn files_to_install_mod(
let files = match determain_mod_kind(mod_to_install, &mod_location)? {
ModKind::Fomod(xml_path) => install_fomod(instance, xml_path, &mod_location)?,
ModKind::EmbeddedData(data_path) => {
install_from_dir(mod_to_install, mod_location.join(data_path))?
}
ModKind::Root => install_from_dir(mod_to_install, mod_location)?,
ModKind::EmbeddedData(_data_path) => install_from_dir(mod_to_install, mod_location)?,
ModKind::Root => install_root(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>> {
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)?
.map(|entry| entry.path().strip_prefix(&mod_location).unwrap().to_owned())
.filter(|rel_path| !glob_filter.is_match(rel_path))