Notmuch dynamic library can now be loaded on macos
On macos, the name of dynamic libraries is a little bit different than on Unix. The code was looking for a `libnotmuch.so.5` library, while on macos it's installed as `libnotmuch.5.dylib`. This commit uses cfg attribute to conditionally change the library name. Closes #106pull/144/head
parent
d6bf700175
commit
b08570349d
|
@ -156,7 +156,11 @@ impl Backends {
|
||||||
}
|
}
|
||||||
#[cfg(feature = "notmuch_backend")]
|
#[cfg(feature = "notmuch_backend")]
|
||||||
{
|
{
|
||||||
if libloading::Library::new("libnotmuch.so.5").is_ok() {
|
#[cfg(not(target_os = "macos"))]
|
||||||
|
let dlpath = "libnotmuch.so.5";
|
||||||
|
#[cfg(target_os = "macos")]
|
||||||
|
let dlpath = "libnotmuch.5.dylib";
|
||||||
|
if libloading::Library::new(dlpath).is_ok() {
|
||||||
b.register(
|
b.register(
|
||||||
"notmuch".to_string(),
|
"notmuch".to_string(),
|
||||||
Backend {
|
Backend {
|
||||||
|
|
|
@ -307,7 +307,11 @@ impl NotmuchDb {
|
||||||
_is_subscribed: Box<dyn Fn(&str) -> bool>,
|
_is_subscribed: Box<dyn Fn(&str) -> bool>,
|
||||||
event_consumer: BackendEventConsumer,
|
event_consumer: BackendEventConsumer,
|
||||||
) -> Result<Box<dyn MailBackend>> {
|
) -> Result<Box<dyn MailBackend>> {
|
||||||
let lib = Arc::new(libloading::Library::new("libnotmuch.so.5")?);
|
#[cfg(not(target_os = "macos"))]
|
||||||
|
let dlpath = "libnotmuch.so.5";
|
||||||
|
#[cfg(target_os = "macos")]
|
||||||
|
let dlpath = "libnotmuch.5.dylib";
|
||||||
|
let lib = Arc::new(libloading::Library::new(dlpath)?);
|
||||||
let path = Path::new(s.root_mailbox.as_str()).expand();
|
let path = Path::new(s.root_mailbox.as_str()).expand();
|
||||||
if !path.exists() {
|
if !path.exists() {
|
||||||
return Err(MeliError::new(format!(
|
return Err(MeliError::new(format!(
|
||||||
|
|
Loading…
Reference in New Issue