From 716517c13fe8e1e5b6b036eae54724cc4c4ccca1 Mon Sep 17 00:00:00 2001 From: Jonathan Turner Date: Tue, 27 Aug 2019 13:46:38 +1200 Subject: [PATCH] Fix having to clean directories when switching between release and debug --- src/cli.rs | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/cli.rs b/src/cli.rs index 614ad28f96..9054bfd2d6 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -121,19 +121,24 @@ fn load_plugins(context: &mut Context) -> Result<(), ShellError> { None => println!("PATH is not defined in the environment."), } - // Also use our debug output for now - let mut path = std::path::PathBuf::from("."); - path.push("target"); - path.push("debug"); + #[cfg(debug_assertions)] + { + // Use our debug plugins in debug mode + let mut path = std::path::PathBuf::from("."); + path.push("target"); + path.push("debug"); + let _ = load_plugins_in_dir(&path, context); + } - let _ = load_plugins_in_dir(&path, context); + #[cfg(not(debug_assertions))] + { + // Use our release plugins in release mode + let mut path = std::path::PathBuf::from("."); + path.push("target"); + path.push("release"); - // Also use our release output for now - let mut path = std::path::PathBuf::from("."); - path.push("target"); - path.push("release"); - - let _ = load_plugins_in_dir(&path, context); + let _ = load_plugins_in_dir(&path, context); + } Ok(()) }