mirror of
https://github.com/atom/atom.git
synced 2026-01-24 14:28:14 -05:00
Ensure install & upgrade fix up previous shell paths
This commit is contained in:
@@ -125,31 +125,35 @@ exports.restartAtom = (app) ->
|
||||
app.once 'will-quit', -> Spawner.spawn(path.join(binFolder, 'atom.cmd'), args)
|
||||
app.quit()
|
||||
|
||||
updateContextMenus = (callback) ->
|
||||
WinShell.fileContextMenu.update ->
|
||||
WinShell.folderContextMenu.update ->
|
||||
WinShell.folderBackgroundContextMenu.update ->
|
||||
callback
|
||||
|
||||
# Handle squirrel events denoted by --squirrel-* command line arguments.
|
||||
exports.handleStartupEvent = (app, squirrelCommand) ->
|
||||
switch squirrelCommand
|
||||
when '--squirrel-install'
|
||||
createShortcuts ->
|
||||
WinShell.fileHandler.register ->
|
||||
addCommandsToPath ->
|
||||
app.quit()
|
||||
addCommandsToPath ->
|
||||
WinShell.fileHandler.register ->
|
||||
updateContextMenus ->
|
||||
app.quit()
|
||||
true
|
||||
when '--squirrel-updated'
|
||||
updateShortcuts ->
|
||||
WinShell.fileHandler.update ->
|
||||
WinShell.fileContextMenu.update ->
|
||||
WinShell.folderContextMenu.update ->
|
||||
WinShell.folderBackgroundContextMenu.update ->
|
||||
addCommandsToPath ->
|
||||
app.quit()
|
||||
addCommandsToPath ->
|
||||
updateContextMenus ->
|
||||
app.quit()
|
||||
true
|
||||
when '--squirrel-uninstall'
|
||||
removeShortcuts ->
|
||||
WinShell.fileHandler.deregister ->
|
||||
WinShell.fileContextMenu.deregister ->
|
||||
WinShell.folderContextMenu.deregister ->
|
||||
WinShell.folderBackgroundContextMenu.deregister ->
|
||||
removeCommandsFromPath ->
|
||||
removeCommandsFromPath ->
|
||||
WinShell.fileHandler.deregister ->
|
||||
WinShell.fileContextMenu.deregister ->
|
||||
WinShell.folderContextMenu.deregister ->
|
||||
WinShell.folderBackgroundContextMenu.deregister ->
|
||||
app.quit()
|
||||
true
|
||||
when '--squirrel-obsolete'
|
||||
|
||||
@@ -17,7 +17,7 @@ class ShellOption
|
||||
doneCount = @parts.length
|
||||
@parts.forEach((part) =>
|
||||
reg = new Registry({hive: 'HKCU', key: if part.key? then "#{@key}\\#{part.key}" else @key})
|
||||
reg.create( -> reg.set part.name, Registry.REG_SZ, part.value, -> callback() if doneCount-- is 0))
|
||||
reg.create( -> reg.set part.name, Registry.REG_SZ, part.value, -> callback() if --doneCount is 0))
|
||||
deregister: (callback) =>
|
||||
@isRegistered (isRegistered) =>
|
||||
if isRegistered
|
||||
@@ -26,11 +26,11 @@ class ShellOption
|
||||
callback null, false
|
||||
update: (callback) =>
|
||||
new Registry({hive: 'HKCU', key: "#{@key}\\#{@parts[0].key}"})
|
||||
.get @parts[0].name, (err, val) ->
|
||||
if err? or not val.value.endsWith '\\' + exeName
|
||||
callback err, val
|
||||
.get @parts[0].name, (err, val) =>
|
||||
if err? or not val.value.includes '\\' + exeName
|
||||
callback(err)
|
||||
else
|
||||
register callback
|
||||
@register callback
|
||||
|
||||
exports.appName = appName
|
||||
|
||||
|
||||
Reference in New Issue
Block a user