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 log::{debug, trace};
|
||||||
|
|
||||||
use crate::types::{Game, Link, ModdedInstance, RootConfig};
|
use crate::types::{Game, Link, ModdedInstance, RootConfig};
|
||||||
@@ -11,7 +11,7 @@ pub fn activate_instance(
|
|||||||
root_config: &RootConfig,
|
root_config: &RootConfig,
|
||||||
instance: &ModdedInstance,
|
instance: &ModdedInstance,
|
||||||
target: impl AsRef<Path>,
|
target: impl AsRef<Path>,
|
||||||
) -> Result<()> {
|
) -> anyhow::Result<()> {
|
||||||
// TODO: Resolve game for instance config
|
// TODO: Resolve game for instance config
|
||||||
let game = root_config
|
let game = root_config
|
||||||
.games()
|
.games()
|
||||||
@@ -22,8 +22,9 @@ pub fn activate_instance(
|
|||||||
|
|
||||||
resolved_links
|
resolved_links
|
||||||
.iter()
|
.iter()
|
||||||
.try_for_each(|link| apply_link(link, target.as_ref()))?;
|
.try_for_each(|link| apply_link(link, &target))
|
||||||
create_plugins_txt(instance, target.as_ref())?;
|
.with_context(|| "Creating links")?;
|
||||||
|
create_plugins_txt(instance, target.as_ref()).with_context(|| "Creating Pluginx.txt")?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@@ -35,7 +36,7 @@ fn resolve_links(
|
|||||||
) -> anyhow::Result<Vec<Link>> {
|
) -> anyhow::Result<Vec<Link>> {
|
||||||
let game_links = game.export_links()?;
|
let game_links = game.export_links()?;
|
||||||
let mod_links = resolve_link_for_instance(root_config, instance)?;
|
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();
|
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<()> {
|
fn create_symlink_for_file(target: &Path, link_name: &Path) -> io::Result<()> {
|
||||||
let absolute_path = fs::canonicalize(target)?;
|
|
||||||
|
|
||||||
trace!(
|
trace!(
|
||||||
"Creating symlink at {} with target {}",
|
"Creating symlink at {} with target {}",
|
||||||
link_name.to_string_lossy(),
|
link_name.to_string_lossy(),
|
||||||
@@ -113,7 +112,7 @@ fn create_symlink_for_file(target: &Path, link_name: &Path) -> io::Result<()> {
|
|||||||
|
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
{
|
{
|
||||||
unix::fs::symlink(absolute_path, link_name)
|
unix::fs::symlink(target, link_name)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
|
|||||||
Reference in New Issue
Block a user