From d1b43786bca5e8e33a124513e81aa7bbba17eafc Mon Sep 17 00:00:00 2001 From: Junko Date: Mon, 27 Nov 2023 08:39:41 +0100 Subject: [PATCH] windows support for modules --- src/main.rs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index b863167..3844a7f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -300,11 +300,21 @@ fn get(config_path: String) -> Result<(), &'static str> { let _ = remove_file(&config.pfp_module.pfp_output_path); } - Command::new("sh").arg("-c").arg(format!("cp {}/{} {}", &config.pfp_module.pfp_folder, pfpnames, &config.pfp_module.pfp_output_path)).output().expect("PFP module error"); + if cfg!(target_os = "windows") { + Command::new("cmd").arg("/C").arg(format!("copy {}/{} {}", &config.pfp_module.pfp_folder, pfpnames, &config.pfp_module.pfp_output_path)).output().expect("PFP module error"); - if config.disc_module.enabled { - let mut c = Command::new("sh").arg("-c").arg(format!("{} {}", &config.disc_module.python_path, &config.disc_module.script_path)).spawn().expect("Discord module error"); - let _ = c.wait().expect("Error"); + if config.disc_module.enabled { + let mut c = Command::new("cmd").arg("/C").arg(format!("{} {}", &config.disc_module.python_path, &config.disc_module.script_path)).spawn().expect("Discord module error"); + let _ = c.wait().expect("Error"); + } + + } else { + Command::new("sh").arg("-c").arg(format!("cp {}/{} {}", &config.pfp_module.pfp_folder, pfpnames, &config.pfp_module.pfp_output_path)).output().expect("PFP module error"); + + if config.disc_module.enabled { + let mut c = Command::new("sh").arg("-c").arg(format!("{} {}", &config.disc_module.python_path, &config.disc_module.script_path)).spawn().expect("Discord module error"); + let _ = c.wait().expect("Error"); + } } }