diff --git a/build.rs b/build.rs index 6c6e91b..695b377 100644 --- a/build.rs +++ b/build.rs @@ -6,12 +6,31 @@ use { winres::WindowsResource, }; +#[cfg(target_os = "linux")] +fn configure_rpath() { + println!("cargo:rustc-link-arg=-Wl,-rpath,$ORIGIN"); +} + +#[cfg(not(target_os = "linux"))] +fn configure_rpath() { + // No action needed for other operating systems +} + fn main() -> io::Result<()> { + // Configure rpath if the target OS is Linux + configure_rpath(); + + // Check if the build is targeting Windows if env::var_os("CARGO_CFG_WINDOWS").is_some() { - WindowsResource::new() - // This path can be absolute, or relative to your crate root. + // If on Windows, compile the Windows resources + if let Err(e) = WindowsResource::new() .set_icon("assets/icon.ico") - .compile()?; + .compile() + { + eprintln!("Error compiling Windows resources: {}", e); + return Err(e.into()); + } } + Ok(()) } \ No newline at end of file diff --git a/src/my_steamworks.rs b/src/my_steamworks.rs index 2c2b419..50c7d24 100644 --- a/src/my_steamworks.rs +++ b/src/my_steamworks.rs @@ -200,7 +200,7 @@ impl WorkshopClient { item_info: ItemInfo, ) -> Result<(PublishedFileId, bool), SteamError> { let temp_dir = std::env::temp_dir(); // Get the temporary directory - let temp_folder = temp_dir.join("wani_workshop_folder"); // Create a specific folder within temporary directory + let mut temp_folder = temp_dir.join("wani_workshop_folder"); // Create a specific folder within temporary directory let mut full_folder = temp_folder.join("mods"); // Create the folders if they doesn't exist @@ -212,11 +212,15 @@ impl WorkshopClient { } if item_info.use_abs_path { - full_folder = temp_folder.clone() + full_folder = item_info.target_folder.clone(); + temp_folder = item_info.target_folder.clone(); } + // // Copy the contents of the target folder to the temporary folder - let _ = fs_extra::dir::copy(&item_info.target_folder, &full_folder, &fs_extra::dir::CopyOptions::new()); + if !item_info.use_abs_path{ + let _ = fs_extra::dir::copy(&item_info.target_folder, &full_folder, &fs_extra::dir::CopyOptions::new()); + } if item_info.convert_rpy {