mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Unload package when uninstalled
This commit is contained in:
@@ -79,6 +79,15 @@ _.extend atom,
|
||||
else
|
||||
throw new Error("Could not resolve '#{name}' to a package path")
|
||||
|
||||
unloadPackage: (name) ->
|
||||
if @isPackageActive(name)
|
||||
throw new Error("Tried to unload active package '#{name}'")
|
||||
|
||||
if pack = @getLoadedPackage(name)
|
||||
delete @loadedPackages[pack.name]
|
||||
else
|
||||
throw new Error("No loaded package for name '#{name}'")
|
||||
|
||||
resolvePackagePath: (name) ->
|
||||
return name if fsUtils.isDirectory(name)
|
||||
path = fsUtils.resolve(config.packageDirPaths..., name)
|
||||
|
||||
@@ -54,6 +54,7 @@ module.exports =
|
||||
apmProcess = spawn(apm, ['uninstall', name])
|
||||
apmProcess.on 'close', (code) =>
|
||||
if code is 0
|
||||
atom.unloadPackage(name)
|
||||
callback()
|
||||
else
|
||||
callback(new Error("Uninstalling '#{name}' failed."))
|
||||
|
||||
Reference in New Issue
Block a user