Create mods dir if it doesn't exist and add context to errors when copying files

This commit is contained in:
Warren Hood 2024-10-21 23:16:12 +02:00
parent 968699c52b
commit 183d8c9fe2
2 changed files with 4 additions and 1 deletions

View file

@ -249,7 +249,9 @@ impl ModpackMeta {
} }
} }
} }
self.copy_files(&source_path, &target_path, file_meta.apply_policy.clone())?; self.copy_files(&source_path, &target_path, file_meta.apply_policy.clone()).with_context(
|| format!("Syncing {} -> {}", source_path.display(), target_path.display())
)?;
} }
} }
Ok(()) Ok(())

View file

@ -38,6 +38,7 @@ impl PinnedPackMeta {
mods_dir: &PathBuf, mods_dir: &PathBuf,
download_side: DownloadSide, download_side: DownloadSide,
) -> Result<()> { ) -> Result<()> {
let _ = std::fs::create_dir_all(mods_dir);
let files = std::fs::read_dir(mods_dir)?; let files = std::fs::read_dir(mods_dir)?;
let mut pinned_files_cache = BTreeSet::new(); let mut pinned_files_cache = BTreeSet::new();
for file in files.into_iter() { for file in files.into_iter() {