From 16118666a9be6225ca3736980bf1d09d6de664ea Mon Sep 17 00:00:00 2001 From: Mathias Buus Date: Thu, 26 Mar 2015 19:34:26 +0100 Subject: [PATCH] guard diplayFolder to only run on osx to fix mafintosh/torrent-mount#20 --- index.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 7386e34..e53c889 100644 --- a/index.js +++ b/index.js @@ -8,8 +8,9 @@ var path = require('path') var noop = function () {} var call = function (cb) { cb() } -var MAC_FOLDER_ICON = '/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/GenericFolderIcon.icns' -var HAS_FOLDER_ICON = os.platform() === 'darwin' && fs.existsSync(MAC_FOLDER_ICON) +var IS_OSX = os.platform() === 'darwin' +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 () { 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 || []) mnt = path.resolve(mnt) - if (ops.displayFolder) { + if (ops.displayFolder && IS_OSX) { // only works on osx if (!ops.options) ops.options = [] 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) {