Skip to content

Commit 175ebb9

Browse files
committed
feat: add macOS support with mojo-audio v0.2.0
- Add libmojo_audio.dylib (macOS arm64) from mojo-audio v0.2.0 release - Update FFI loader to use platform-specific library name (.dylib/.so) - Fix config path to use confy's cross-platform path (via config::config_path) - Fix daemon socket path to use state::get_state_dir for macOS compatibility - Initialize config on Tauri app startup to prevent missing config errors - Add Tauri macOS schema
1 parent 0ec15da commit 175ebb9

6 files changed

Lines changed: 6183 additions & 21 deletions

File tree

lib/libmojo_audio.dylib

34.5 KB
Binary file not shown.

src/transcribe/mojo_ffi.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ impl MojoAudio {
115115
fn load_from_path(lib_path: &Path) -> Result<Self> {
116116
// SAFETY: We're loading a known library with C ABI functions
117117
let lib = unsafe { Library::new(lib_path) }
118-
.map_err(|e| anyhow!("Failed to load libmojo_audio.so: {}", e))?;
118+
.map_err(|e| anyhow!("Failed to load mojo-audio library: {}", e))?;
119119

120120
// SAFETY: These symbols match the C header definitions
121121
unsafe {
@@ -159,16 +159,22 @@ impl MojoAudio {
159159
/// Get the global mojo-audio instance, loading if necessary
160160
pub fn get() -> Result<&'static Self> {
161161
let result = MOJO_AUDIO.get_or_init(|| {
162+
// Platform-specific library name
163+
#[cfg(target_os = "macos")]
164+
let lib_name = "libmojo_audio.dylib";
165+
#[cfg(not(target_os = "macos"))]
166+
let lib_name = "libmojo_audio.so";
167+
162168
// Try multiple paths for the library
163169
let paths = [
164170
// Relative to executable (for releases)
165171
std::env::current_exe()
166172
.ok()
167-
.and_then(|p| p.parent().map(|p| p.join("lib/libmojo_audio.so"))),
173+
.and_then(|p| p.parent().map(|p| p.join(format!("lib/{}", lib_name)))),
168174
// Development path
169-
Some(std::path::PathBuf::from("lib/libmojo_audio.so")),
175+
Some(std::path::PathBuf::from(format!("lib/{}", lib_name))),
170176
// System path
171-
Some(std::path::PathBuf::from("/usr/local/lib/libmojo_audio.so")),
177+
Some(std::path::PathBuf::from(format!("/usr/local/lib/{}", lib_name))),
172178
];
173179

174180
for path in paths.iter().flatten() {
@@ -189,7 +195,7 @@ impl MojoAudio {
189195
}
190196
}
191197

192-
Err("Could not find libmojo_audio.so in any search path".to_string())
198+
Err(format!("Could not find {} in any search path", lib_name))
193199
});
194200

195201
result.as_ref().map_err(|e| anyhow!("{}", e))

0 commit comments

Comments
 (0)