|
|
@ -69,17 +69,18 @@ exports.mount = function (mnt, ops, cb) {
|
|
|
|
|
|
|
|
|
|
|
|
var mount = function () {
|
|
|
|
var mount = function () {
|
|
|
|
// TODO: I got a feeling this can be done better
|
|
|
|
// TODO: I got a feeling this can be done better
|
|
|
|
if(os.platform() !== 'win32') {
|
|
|
|
if (os.platform() !== 'win32') {
|
|
|
|
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'))
|
|
|
|
if (!stat.isDirectory()) return cb(new Error('Mountpoint is not a directory'))
|
|
|
|
if (!stat.isDirectory()) return cb(new Error('Mountpoint is not a directory'))
|
|
|
|
fs.stat(path.join(mnt, '..'), function (_, parent) {
|
|
|
|
fs.stat(path.join(mnt, '..'), function (_, parent) {
|
|
|
|
if (parent && parent.dev !== stat.dev) return cb(new Error('Mountpoint in use'))
|
|
|
|
if (parent && parent.dev !== stat.dev) return cb(new Error('Mountpoint in use'))
|
|
|
|
fuse.mount(mnt, ops)
|
|
|
|
fuse.mount(mnt, ops)
|
|
|
|
})
|
|
|
|
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
fuse.mount(mnt, ops)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else fuse.mount(mnt, ops)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!ops.force) return mount()
|
|
|
|
if (!ops.force) return mount()
|
|
|
|