Skip to content

Commit

Permalink
Merge pull request #49 from pulsar-edit/update-hardcoded-pulsar-insta…
Browse files Browse the repository at this point in the history
…ll-paths

src: Update default Pulsar install paths
  • Loading branch information
DeeDeeG authored Feb 24, 2023
2 parents dae8bbc + 5115ae9 commit 68257a4
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions src/apm.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -44,21 +44,18 @@ module.exports =

switch process.platform
when 'darwin'
child_process.exec 'mdfind "kMDItemCFBundleIdentifier == \'com.github.atom\'"', (error, stdout='', stderr) ->
child_process.exec 'mdfind "kMDItemCFBundleIdentifier == \'dev.pulsar-edit.pulsar\'"', (error, stdout='', stderr) ->
[appLocation] = stdout.split('\n') unless error
appLocation = '/Applications/Atom.app' unless appLocation
appLocation = '/Applications/Pulsar.app' unless appLocation
asarPath = "#{appLocation}/Contents/Resources/app.asar"
return process.nextTick -> callback(asarPath)
when 'linux'
asarPath = '/usr/local/share/atom/resources/app.asar'
unless fs.existsSync(asarPath)
asarPath = '/usr/share/atom/resources/app.asar'
asarPath = '/opt/Pulsar/resources/app.asar'
return process.nextTick -> callback(asarPath)
when 'win32'
glob = require 'glob'
pattern = "/Users/#{process.env.USERNAME}/AppData/Local/atom/app-+([0-9]).+([0-9]).+([0-9])/resources/app.asar"
asarPaths = glob.sync(pattern, null) # [] | a sorted array of locations with the newest version being last
asarPath = asarPaths[asarPaths.length - 1]
asarPath = "/Users/#{process.env.USERNAME}/AppData/Local/Programs/Pulsar/resources/app.asar"
unless fs.existsSync(asarPath)
asarPath = "/Program Files/Pulsar/resources/app.asar"
return process.nextTick -> callback(asarPath)
else
return process.nextTick -> callback('')
Expand Down

0 comments on commit 68257a4

Please sign in to comment.