Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
ohchase committed Aug 11, 2024
1 parent 0e3fa3e commit cc52a6f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion examples/hook_getpid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,13 @@ fn find_executable<'a>() -> Option<plt_rs::LoadedLibrary<'a>> {
/// Finding executable target differs on unix and android
#[cfg(target_os = "android")]
fn find_executable<'a>() -> Option<plt_rs::LoadedLibrary<'a>> {
let executable = std::env::current_exe().expect("current exe");
let file_stem = executable.file_stem()?;
let file_stem = file_stem.to_str()?;
let loaded_modules = collect_modules();
loaded_modules
.into_iter()
.filter(|lib| lib.name().contains("hook_getpid"))
.filter(|lib| lib.name().contains(file_stem))
.next()
}

Expand Down

0 comments on commit cc52a6f

Please sign in to comment.