fixed overrides not working
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use anyhow::{Result, anyhow};
|
||||
use anyhow::{Context, anyhow};
|
||||
use log::{debug, trace};
|
||||
|
||||
use crate::types::{Game, Link, ModdedInstance, RootConfig};
|
||||
@@ -11,7 +11,7 @@ pub fn activate_instance(
|
||||
root_config: &RootConfig,
|
||||
instance: &ModdedInstance,
|
||||
target: impl AsRef<Path>,
|
||||
) -> Result<()> {
|
||||
) -> anyhow::Result<()> {
|
||||
// TODO: Resolve game for instance config
|
||||
let game = root_config
|
||||
.games()
|
||||
@@ -22,8 +22,9 @@ pub fn activate_instance(
|
||||
|
||||
resolved_links
|
||||
.iter()
|
||||
.try_for_each(|link| apply_link(link, target.as_ref()))?;
|
||||
create_plugins_txt(instance, target.as_ref())?;
|
||||
.try_for_each(|link| apply_link(link, &target))
|
||||
.with_context(|| "Creating links")?;
|
||||
create_plugins_txt(instance, target.as_ref()).with_context(|| "Creating Pluginx.txt")?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
@@ -35,7 +36,7 @@ fn resolve_links(
|
||||
) -> anyhow::Result<Vec<Link>> {
|
||||
let game_links = game.export_links()?;
|
||||
let mod_links = resolve_link_for_instance(root_config, instance)?;
|
||||
let overrides = instance.game_file_overrides().to_owned();
|
||||
let overrides: Vec<Link> = instance.game_file_overrides().to_owned();
|
||||
|
||||
let mut map: HashMap<PathBuf, PathBuf> = HashMap::new();
|
||||
|
||||
@@ -103,8 +104,6 @@ fn link_file(target: &Path, link_name: &Path) -> Result<(), io::Error> {
|
||||
}
|
||||
|
||||
fn create_symlink_for_file(target: &Path, link_name: &Path) -> io::Result<()> {
|
||||
let absolute_path = fs::canonicalize(target)?;
|
||||
|
||||
trace!(
|
||||
"Creating symlink at {} with target {}",
|
||||
link_name.to_string_lossy(),
|
||||
@@ -113,7 +112,7 @@ fn create_symlink_for_file(target: &Path, link_name: &Path) -> io::Result<()> {
|
||||
|
||||
#[cfg(unix)]
|
||||
{
|
||||
unix::fs::symlink(absolute_path, link_name)
|
||||
unix::fs::symlink(target, link_name)
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
|
||||
Reference in New Issue
Block a user