joe42 / CloudFusion

Linux file system (FUSE) to access Dropbox, Sugarsync, Amazon S3, Google Storage, Google Drive or WebDAV servers.
http://joe42.github.com/CloudFusion/
288 stars 35 forks source link

Allow user-specified path to libfuse #28

Open posita opened 8 years ago

posita commented 8 years ago

Please consider incorporating the following patch to fuse.py that allows one to explicitly override the path to libfuse by setting the LIBFUSE_PATH environment variable (e.g., if it is stored in a nonstandard location):

diff --git a/cloudfusion/fuse.py b/cloudfusion/fuse.py
index a062031..de6252a 100644
--- a/cloudfusion/fuse.py
+++ b/cloudfusion/fuse.py
@@ -18,7 +18,7 @@ from ctypes import *
 from ctypes.util import find_library
 from errno import *
 from functools import partial
-from os import strerror
+from os import environ, strerror
 from platform import machine, system
 from stat import S_IFDIR
 from traceback import print_exc
@@ -239,7 +239,7 @@ def set_st_attrs(st, attrs):
             setattr(st, key, val)

-_libfuse_path = find_library('fuse')
+_libfuse_path = environ.get('LIBFUSE_PATH', find_library('fuse'))
 if not _libfuse_path:
     raise EnvironmentError('Unable to find libfuse')
 _libfuse = CDLL(_libfuse_path)

Use:

LIBFUSE_PATH=/path/to/libfuse.so cloudfusion ...

I can submit a PR if desired.