Linux bullshit

This commit is contained in:
Legalo 2024-04-09 23:16:48 -03:00
parent b4020c4049
commit 53898e90be
2 changed files with 29 additions and 6 deletions

View File

@ -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(())
}

View File

@ -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 {