Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Linux desktop entry filename fix #91

Merged
merged 3 commits into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.opts.appName).to.equal 'node-auto-launch test'
done()
return


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