Skip to content

Commit 2a3a6f7

Browse files
committed
Toolbox: hide DependencyControl and its dependencies from the uninstall list to prevent accidents
1 parent 7d139fc commit 2a3a6f7

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

macros/l0.DependencyControl.Toolbox.moon

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,14 @@ msgs = {
2929

3030
-- Shared Functions
3131

32-
buildInstalledDlgList = (scriptType, config) ->
33-
list, map = {}, {}
32+
buildInstalledDlgList = (scriptType, config, isUninstall) ->
33+
list, map, protectedModules = {}, {}, {}
34+
if isUninstall
35+
protectedModules[mdl.moduleName] = true for mdl in *DepCtrl.version.requiredModules
36+
protectedModules[DepCtrl.version.moduleName] = true
37+
3438
for namespace, script in pairs config.c[scriptType]
39+
continue if protectedModules[namespace]
3540
item = "%s v%s%s"\format script.name, depRec\getVersionString(script.version),
3641
script.activeChannel and " [#{script.activeChannel}]" or ""
3742
list[#list+1] = item
@@ -145,8 +150,8 @@ uninstall = ->
145150
config = getConfig!
146151

147152
-- build macro and module lists as well as reverse mappings
148-
moduleList, moduleMap = buildInstalledDlgList "modules", config
149-
macroList, macroMap = buildInstalledDlgList "macros", config
153+
moduleList, moduleMap = buildInstalledDlgList "modules", config, true
154+
macroList, macroMap = buildInstalledDlgList "macros", config, true
150155

151156
btn, res = aegisub.dialog.display getScriptListDlg macroList, moduleList
152157
return unless btn

0 commit comments

Comments
 (0)