Skip to content

Commit

Permalink
Toolbox: hide DependencyControl and its dependencies from the uninsta…
Browse files Browse the repository at this point in the history
…ll list to prevent accidents
  • Loading branch information
line0 committed May 2, 2015
1 parent 7d139fc commit 2a3a6f7
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions macros/l0.DependencyControl.Toolbox.moon
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,14 @@ msgs = {

-- Shared Functions

buildInstalledDlgList = (scriptType, config) ->
list, map = {}, {}
buildInstalledDlgList = (scriptType, config, isUninstall) ->
list, map, protectedModules = {}, {}, {}
if isUninstall
protectedModules[mdl.moduleName] = true for mdl in *DepCtrl.version.requiredModules
protectedModules[DepCtrl.version.moduleName] = true

for namespace, script in pairs config.c[scriptType]
continue if protectedModules[namespace]
item = "%s v%s%s"\format script.name, depRec\getVersionString(script.version),
script.activeChannel and " [#{script.activeChannel}]" or ""
list[#list+1] = item
Expand Down Expand Up @@ -145,8 +150,8 @@ uninstall = ->
config = getConfig!

-- build macro and module lists as well as reverse mappings
moduleList, moduleMap = buildInstalledDlgList "modules", config
macroList, macroMap = buildInstalledDlgList "macros", config
moduleList, moduleMap = buildInstalledDlgList "modules", config, true
macroList, macroMap = buildInstalledDlgList "macros", config, true

btn, res = aegisub.dialog.display getScriptListDlg macroList, moduleList
return unless btn
Expand Down

0 comments on commit 2a3a6f7

Please sign in to comment.