|
|
@ -2,6 +2,7 @@ var bindings = require('bindings')
|
|
|
|
var fuse = bindings('fuse_bindings')
|
|
|
|
var fuse = bindings('fuse_bindings')
|
|
|
|
var fs = require('fs')
|
|
|
|
var fs = require('fs')
|
|
|
|
var os = require('os')
|
|
|
|
var os = require('os')
|
|
|
|
|
|
|
|
var xtend = require('xtend')
|
|
|
|
var path = require('path')
|
|
|
|
var path = require('path')
|
|
|
|
|
|
|
|
|
|
|
|
var noop = function () {}
|
|
|
|
var noop = function () {}
|
|
|
@ -24,8 +25,8 @@ fuse.setCallback(function (index, callback) {
|
|
|
|
|
|
|
|
|
|
|
|
exports.mount = function (mnt, ops, cb) {
|
|
|
|
exports.mount = function (mnt, ops, cb) {
|
|
|
|
if (!cb) cb = noop
|
|
|
|
if (!cb) cb = noop
|
|
|
|
if (!ops) ops = {}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ops = xtend(ops) // clone
|
|
|
|
if (/\*|(^,)fuse-bindings(,$)/.test(process.env.DEBUG)) ops.options = ['debug'].concat(ops.options || [])
|
|
|
|
if (/\*|(^,)fuse-bindings(,$)/.test(process.env.DEBUG)) ops.options = ['debug'].concat(ops.options || [])
|
|
|
|
mnt = path.resolve(mnt)
|
|
|
|
mnt = path.resolve(mnt)
|
|
|
|
|
|
|
|
|
|
|
@ -37,8 +38,6 @@ exports.mount = function (mnt, ops, cb) {
|
|
|
|
|
|
|
|
|
|
|
|
var callback = function (err) {
|
|
|
|
var callback = function (err) {
|
|
|
|
callback = noop
|
|
|
|
callback = noop
|
|
|
|
ops.init = init
|
|
|
|
|
|
|
|
ops.error = error
|
|
|
|
|
|
|
|
setImmediate(cb.bind(null, err))
|
|
|
|
setImmediate(cb.bind(null, err))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -54,6 +53,13 @@ exports.mount = function (mnt, ops, cb) {
|
|
|
|
error(next)
|
|
|
|
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 () {
|
|
|
|
var mount = function () {
|
|
|
|
fs.stat(mnt, function (err, stat) {
|
|
|
|
fs.stat(mnt, function (err, stat) {
|
|
|
|
if (err) return cb(new Error('Mountpoint does not exist'))
|
|
|
|
if (err) return cb(new Error('Mountpoint does not exist'))
|
|
|
|