Darktide Mod Manager #39
1 changed files with 11 additions and 7 deletions
|
@ -253,7 +253,7 @@ async fn build_bundles(state: Arc<State>) -> Result<()> {
|
||||||
.to_string()
|
.to_string()
|
||||||
.to_ascii_lowercase();
|
.to_ascii_lowercase();
|
||||||
let src = mod_dir.join(&bundle_name);
|
let src = mod_dir.join(&bundle_name);
|
||||||
let dest = bundle_dir.clone();
|
let dest = bundle_dir.join(&bundle_name);
|
||||||
let pkg_name = pkg_info.get_name().clone();
|
let pkg_name = pkg_info.get_name().clone();
|
||||||
let mod_name = mod_info.get_name().clone();
|
let mod_name = mod_info.get_name().clone();
|
||||||
|
|
||||||
|
@ -276,14 +276,18 @@ async fn build_bundles(state: Arc<State>) -> Result<()> {
|
||||||
dest.display()
|
dest.display()
|
||||||
);
|
);
|
||||||
// We attempt to remove any previous file, so that the hard link can be created.
|
// We attempt to remove any previous file, so that the hard link can be created.
|
||||||
// We can reasonably ignore errors here, as a 'NotFound' is actually fine, the link
|
// We can reasonably ignore errors here, as a 'NotFound' is actually fine, the copy
|
||||||
// may be possible anyways, or the error will be reported by it anyways.
|
// may be possible despite an error here, or the error will be reported by it anyways.
|
||||||
// TODO: There is a chance that we delete an actual game bundle, but with 64bit
|
// TODO: There is a chance that we delete an actual game bundle, but with 64bit
|
||||||
// hashes, it's low enough for now, and the set up required to detect
|
// hashes, it's low enough for now, and the setup required to detect
|
||||||
// "game bundle vs mod bundle" is non-trivial.
|
// "game bundle vs mod bundle" is non-trivial.
|
||||||
let _ = fs::remove_file(dest.as_ref()).await;
|
let _ = fs::remove_file(&dest).await;
|
||||||
fs::hard_link(&src, dest.as_ref()).await.wrap_err_with(|| {
|
fs::copy(&src, &dest).await.wrap_err_with(|| {
|
||||||
format!("failed to hard link bundle {pkg_name} for mod {mod_name}. src: {}, dest: {}", src.display(), dest.display())
|
format!(
|
||||||
|
"failed to copy bundle {pkg_name} for mod {mod_name}. src: {}, dest: {}",
|
||||||
|
src.display(),
|
||||||
|
dest.display()
|
||||||
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
.instrument(span);
|
.instrument(span);
|
||||||
|
|
Loading…
Add table
Reference in a new issue