diff --git a/src/index.coffee b/src/index.coffee index fc7f517..2e62fa7 100644 --- a/src/index.coffee +++ b/src/index.coffee @@ -82,15 +82,14 @@ module.exports = class AutoLaunch if /darwin/.test process.platform @opts.appPath = @fixMacExecPath(@opts.appPath, @opts.mac) - if @opts.appPath.indexOf('/') isnt -1 - tempPath = @opts.appPath.split '/' - @opts.appName = tempPath[tempPath.length - 1] - else if @opts.appPath.indexOf('\\') isnt -1 + if @opts.appPath.indexOf('\\') isnt -1 tempPath = @opts.appPath.split '\\' @opts.appName = tempPath[tempPath.length - 1] @opts.appName = @opts.appName.substr(0, @opts.appName.length - '.exe'.length) if /darwin/.test process.platform + tempPath = @opts.appPath.split '/' + @opts.appName = tempPath[tempPath.length - 1] # Remove ".app" from the appName if it exists if @opts.appName.indexOf('.app', @opts.appName.length - '.app'.length) isnt -1 @opts.appName = @opts.appName.substr(0, @opts.appName.length - '.app'.length) \ No newline at end of file diff --git a/tests/index.coffee b/tests/index.coffee index 5014b7e..45143e5 100644 --- a/tests/index.coffee +++ b/tests/index.coffee @@ -12,6 +12,7 @@ else if /darwin/.test process.platform isMac = true executablePath = '/Applications/Calculator.app' else if (/linux/.test process.platform) or (/freebsd/.test process.platform) + isLinux = true executablePath = path.resolve path.join './tests/executables', 'hv3-linux-x86' console.log "Executable being used for tests:", executablePath @@ -91,6 +92,11 @@ describe 'node-auto-launch', -> return + if isLinux + it 'should use name option', (done) -> + expect(autoLaunch.opts.appName).to.equal 'node-auto-launch test' + done() + return # Let's test some Mac-only options