Skip to content

Commit 8dc417a

Browse files
committed
rust: default intercept config added for non-linux os
1 parent f85263b commit 8dc417a

File tree

1 file changed

+26
-3
lines changed

1 file changed

+26
-3
lines changed

rust/bear/src/config.rs

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,19 +222,42 @@ pub enum Intercept {
222222

223223
/// The default intercept mode is varying based on the target operating system.
224224
impl Default for Intercept {
225-
#[cfg(target_os = "linux")]
225+
#[cfg(any(
226+
target_os = "linux",
227+
target_os = "freebsd",
228+
target_os = "netbsd",
229+
target_os = "openbsd",
230+
target_os = "dragonfly"
231+
))]
226232
fn default() -> Self {
227233
Intercept::Preload {
228234
path: default_preload_library(),
229235
}
230236
}
231237

232-
#[cfg(not(target_os = "linux"))]
238+
#[cfg(any(target_os = "macos", target_os = "ios"))]
233239
fn default() -> Self {
234240
Intercept::Wrapper {
235241
path: default_wrapper_executable(),
236242
directory: default_wrapper_directory(),
237-
executables: vec![], // FIXME: better default value
243+
executables: vec![
244+
PathBuf::from("/usr/bin/cc"),
245+
PathBuf::from("/usr/bin/c++"),
246+
PathBuf::from("/usr/bin/clang"),
247+
PathBuf::from("/usr/bin/clang++"),
248+
],
249+
}
250+
}
251+
252+
#[cfg(target_os = "windows")]
253+
fn default() -> Self {
254+
Intercept::Wrapper {
255+
path: default_wrapper_executable(),
256+
directory: default_wrapper_directory(),
257+
executables: vec![
258+
PathBuf::from("C:\\msys64\\mingw64\\bin\\gcc.exe"),
259+
PathBuf::from("C:\\msys64\\mingw64\\bin\\g++.exe"),
260+
],
238261
}
239262
}
240263
}

0 commit comments

Comments
 (0)