diff --git a/index.js b/index.js index 1f805db..78dfa49 100644 --- a/index.js +++ b/index.js @@ -2,6 +2,7 @@ var bindings = require('bindings') var fuse = bindings('fuse_bindings') var fs = require('fs') var os = require('os') +var xtend = require('xtend') var path = require('path') var noop = function () {} @@ -24,8 +25,8 @@ fuse.setCallback(function (index, callback) { exports.mount = function (mnt, ops, cb) { if (!cb) cb = noop - if (!ops) ops = {} + ops = xtend(ops) // clone if (/\*|(^,)fuse-bindings(,$)/.test(process.env.DEBUG)) ops.options = ['debug'].concat(ops.options || []) mnt = path.resolve(mnt) @@ -37,8 +38,6 @@ exports.mount = function (mnt, ops, cb) { var callback = function (err) { callback = noop - ops.init = init - ops.error = error setImmediate(cb.bind(null, err)) } @@ -54,6 +53,13 @@ exports.mount = function (mnt, ops, cb) { error(next) } + if (!ops.getattr) { // we need this for unmount to work on osx + ops.getattr = function (path, cb) { + if (path !== '/') return cb(fuse.EPERM) + cb(null, {mtime: new Date(0), atime: new Date(0), ctime: new Date(0), mode: 16877, size: 4096}) + } + } + var mount = function () { fs.stat(mnt, function (err, stat) { if (err) return cb(new Error('Mountpoint does not exist')) diff --git a/package.json b/package.json index 2b245c1..cbee041 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,8 @@ "gypfile": true, "dependencies": { "bindings": "^1.2.1", - "nan": "^1.7.0" + "nan": "^1.7.0", + "xtend": "^4.0.0" }, "devDependencies": { "standard": "^3.2.0"