Skip to content

Commit c0c723a

Browse files
committed
fix(gum): add freebsd for frida_g_get_*_dir functions
1 parent 1a89408 commit c0c723a

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

frida-gum/src/process.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ use alloc::{string::String, string::ToString, vec::Vec};
2020
use cstr_core::CString;
2121
use frida_gum_sys::GumThreadFlags_GUM_THREAD_FLAGS_ALL;
2222

23-
#[cfg(target_os = "linux")]
23+
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
2424
extern "C" {
2525
pub fn _frida_g_get_home_dir() -> *const c_char;
2626
pub fn _frida_g_get_current_dir() -> *const c_char;
2727
pub fn _frida_g_get_tmp_dir() -> *const c_char;
2828
}
2929

30-
#[cfg(not(target_os = "linux"))]
30+
#[cfg(not(any(target_os = "linux", target_os = "freebsd")))]
3131
extern "C" {
3232
pub fn g_get_home_dir() -> *const c_char;
3333
pub fn g_get_current_dir() -> *const c_char;
@@ -130,9 +130,9 @@ impl<'a> Process<'a> {
130130
/// Returns a string specifying the filesystem path to the current working directory
131131
pub fn current_dir(&self) -> String {
132132
unsafe {
133-
#[cfg(target_os = "linux")]
133+
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
134134
let dir = _frida_g_get_current_dir();
135-
#[cfg(not(target_os = "linux"))]
135+
#[cfg(not(any(target_os = "linux", target_os = "freebsd")))]
136136
let dir = g_get_current_dir();
137137

138138
CStr::from_ptr(dir).to_string_lossy().to_string()
@@ -142,9 +142,9 @@ impl<'a> Process<'a> {
142142
/// Returns a string specifying the filesystem path to the directory to use for temporary files
143143
pub fn tmp_dir(&self) -> String {
144144
unsafe {
145-
#[cfg(target_os = "linux")]
145+
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
146146
let dir = _frida_g_get_tmp_dir();
147-
#[cfg(not(target_os = "linux"))]
147+
#[cfg(not(any(target_os = "linux", target_os = "freebsd")))]
148148
let dir = g_get_tmp_dir();
149149

150150
CStr::from_ptr(dir).to_string_lossy().to_string()
@@ -154,9 +154,9 @@ impl<'a> Process<'a> {
154154
/// Returns a string specifying the filesystem path to the current user’s home directory
155155
pub fn home_dir(&self) -> String {
156156
unsafe {
157-
#[cfg(target_os = "linux")]
157+
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
158158
let dir = _frida_g_get_home_dir();
159-
#[cfg(not(target_os = "linux"))]
159+
#[cfg(not(any(target_os = "linux", target_os = "freebsd")))]
160160
let dir = g_get_home_dir();
161161

162162
CStr::from_ptr(dir).to_string_lossy().to_string()

0 commit comments

Comments
 (0)