1
0
mirror of https://github.com/fuse-friends/fuse-native synced 2024-10-27 18:34:01 +00:00

guard diplayFolder to only run on osx to fix mafintosh/torrent-mount#20

This commit is contained in:
Mathias Buus 2015-03-26 19:34:26 +01:00
parent 6916670b73
commit 16118666a9

View File

@ -8,8 +8,9 @@ var path = require('path')
var noop = function () {} var noop = function () {}
var call = function (cb) { cb() } var call = function (cb) { cb() }
var MAC_FOLDER_ICON = '/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/GenericFolderIcon.icns' var IS_OSX = os.platform() === 'darwin'
var HAS_FOLDER_ICON = os.platform() === 'darwin' && fs.existsSync(MAC_FOLDER_ICON) var OSX_FOLDER_ICON = '/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/GenericFolderIcon.icns'
var HAS_FOLDER_ICON = IS_OSX && fs.existsSync(OSX_FOLDER_ICON)
var FuseBuffer = function () { var FuseBuffer = function () {
this.length = 0 this.length = 0
@ -30,10 +31,10 @@ exports.mount = function (mnt, ops, cb) {
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)
if (ops.displayFolder) { if (ops.displayFolder && IS_OSX) { // only works on osx
if (!ops.options) ops.options = [] if (!ops.options) ops.options = []
ops.options.push('volname=' + path.basename(mnt)) ops.options.push('volname=' + path.basename(mnt))
if (HAS_FOLDER_ICON) ops.options.push('volicon=' + MAC_FOLDER_ICON) if (HAS_FOLDER_ICON) ops.options.push('volicon=' + OSX_FOLDER_ICON)
} }
var callback = function (err) { var callback = function (err) {