diff --git a/fuse/host_cgo.go b/fuse/host_cgo.go index 7a3c65a..d2001ff 100644 --- a/fuse/host_cgo.go +++ b/fuse/host_cgo.go @@ -169,9 +169,14 @@ static void *cgofuse_init_fuse(void) if (0 == (*(void **)&(pfn_ ## n) = dlsym(h, #n)))\ return 0; - void *h; + void *h = 0; #if defined(__APPLE__) - h = dlopen("/usr/local/lib/libfuse.2.dylib", RTLD_NOW); // MacFUSE/OSXFuse >= v4 + // runtime path for bundled dylib in e.g. Awesome.app/Contents/Frameworks/libfuse.dylib + const char *dylib_path = getenv("CGOFUSE_LIBFUSE_PATH"); + if(0 != dylib_path) + h = dlopen(dylib_path, RTLD_NOW); + if (0 == h) + h = dlopen("/usr/local/lib/libfuse.2.dylib", RTLD_NOW); // MacFUSE/OSXFuse >= v4 if (0 == h) h = dlopen("/usr/local/lib/libosxfuse.2.dylib", RTLD_NOW); // MacFUSE/OSXFuse < v4 if (0 == h)