Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't try to remove autodetected DLLs #2232

Merged
merged 1 commit into from
Dec 24, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions Cmdline/Action/Remove.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,10 @@ public int RunCommand(CKAN.KSP ksp, object raw_options)

// Get the list of installed modules
IRegistryQuerier registry = RegistryManager.Instance(ksp).registry;
var installed = new SortedDictionary<string, Version>(registry.Installed(false));

// Try every regex on every installed module:
// if it matches, select for removal
foreach (string mod in installed.Keys)
foreach (string mod in registry.InstalledModules.Select(mod => mod.identifier))
{
if (justins.Any(re => re.IsMatch(mod)))
selectedModules.Add(mod);
Expand All @@ -52,12 +51,11 @@ public int RunCommand(CKAN.KSP ksp, object raw_options)
if (options.rmall)
{
log.Debug("Removing all mods");
// Get the list of installed modules
// Add the list of installed modules to the list that should be uninstalled
IRegistryQuerier registry = RegistryManager.Instance(ksp).registry;
var installed = new SortedDictionary<string, Version>(registry.Installed(false));

// Add it to the list that should be uninstalled.
options.modules.AddRange(installed.Keys);
options.modules.AddRange(
registry.InstalledModules.Select(mod => mod.identifier)
);
}

if (options.modules != null && options.modules.Count > 0)
Expand Down