From 1f4691cb721ffe127662d97b17fcdf2a9da1fb17 Mon Sep 17 00:00:00 2001 From: Niklas Kapelle Date: Mon, 2 Mar 2026 16:16:26 +0100 Subject: [PATCH] added create plugin txt to linker --- src/linker.rs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/linker.rs b/src/linker.rs index cb0c215..14183b2 100644 --- a/src/linker.rs +++ b/src/linker.rs @@ -1,9 +1,9 @@ -use std::{fs, io, os::unix, path::Path}; - use crate::{ basic_types::{ModdedInstance, RootConfig}, utils::walk_files_recursive, }; +use std::io::Write; +use std::{fs, io, os::unix, path::Path}; pub fn link_instance_to_target( root_config: &RootConfig, @@ -46,6 +46,21 @@ fn link_file(target: &Path, link_name: &Path) -> Result<(), io::Error> { Ok(()) } +pub fn create_plugins_txt( + instance: &ModdedInstance, + target: impl AsRef, +) -> Result<(), io::Error> { + let mut file = fs::File::create(target.as_ref().join("plugins.txt"))?; + + writeln!(file, "# Auto generated. DO NOT EDIT MANUALLY!")?; + + for plugin in instance.load_order() { + writeln!(file, "*{}", plugin)?; + } + + Ok(()) +} + fn create_symlink_for_file(target: &Path, link_name: &Path) -> io::Result<()> { let absolute_path = fs::canonicalize(target)?;