From c3ad93addb1204808c680d3dd7db9a2086392a53 Mon Sep 17 00:00:00 2001 From: Joshua Goins Date: Sat, 29 Jun 2024 20:07:19 -0400 Subject: [PATCH] Add new execlookup api --- Cargo.lock | 2 +- src/execlookup.rs | 14 ++++++++++++++ src/lib.rs | 2 ++ 3 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 src/execlookup.rs diff --git a/Cargo.lock b/Cargo.lock index 35bb85a..b98ab76 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -300,7 +300,7 @@ checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" [[package]] name = "physis" version = "0.4.0" -source = "git+https://github.com/redstrate/physis#c90a46186f0cc54db930e2754db73bfc4cce36ad" +source = "git+https://github.com/redstrate/physis#d8fae2f822d02e3602af295fad5f1905c4e24e65" dependencies = [ "binrw", "bitflags 1.3.2", diff --git a/src/execlookup.rs b/src/execlookup.rs new file mode 100644 index 0000000..8244422 --- /dev/null +++ b/src/execlookup.rs @@ -0,0 +1,14 @@ +use core::ffi::c_char; +use core::ptr::null; +use crate::{ffi_from_c_string, ffi_to_c_string}; +use physis::execlookup::extract_frontier_url; + +#[no_mangle] +pub extern "C" fn physis_extract_frontier_url(launcher_path: *const c_char) -> *const c_char { + let launcher_path = ffi_from_c_string(launcher_path).unwrap(); + if let Some(frontier_url) = extract_frontier_url(&launcher_path) { + ffi_to_c_string(&frontier_url) + } else { + null() + } +} \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index 7b66836..f85feae 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -142,3 +142,5 @@ mod logging; mod schd; mod existing_dirs; + +mod execlookup; \ No newline at end of file