Skip to content

Commit

Permalink
fix: Linux desktop entry file should be named based on name, not `p…
Browse files Browse the repository at this point in the history
…ath`

no need to overwrite `name` options with filename on Linux

..plus test

fixes #90
  • Loading branch information
artemv committed Nov 12, 2018
1 parent 1394a0a commit 5aa6d89
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/index.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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)
6 changes: 6 additions & 0 deletions tests/index.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ else if /darwin/.test process.platform
isMac = true
executablePath = '/Applications/Calculator.app'
else if /linux/.test process.platform
isLinux = true
executablePath = path.resolve path.join './tests/executables', 'hv3-linux-x86'

console.log "Executable being used for tests:", executablePath
Expand Down Expand Up @@ -91,6 +92,11 @@ describe 'node-auto-launch', ->
return


if isLinux
it 'should use name option', (done) ->
expect(autoLaunch.name).to.equal 'node-auto-launch test'
done()
return


# Let's test some Mac-only options
Expand Down

0 comments on commit 5aa6d89

Please sign in to comment.