Skip to content

Commit

Permalink
Mark auto-install correctly when installing from .ckan file
Browse files Browse the repository at this point in the history
  • Loading branch information
HebaruSan committed Jun 22, 2019
1 parent 74ff9af commit 91c5bf4
Showing 1 changed file with 11 additions and 22 deletions.
33 changes: 11 additions & 22 deletions GUI/MainInstall.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,43 +26,32 @@ public partial class Main
/// <param name="module">Module to install</param>
public async void InstallModuleDriver(IRegistryQuerier registry, CkanModule module)
{
RelationshipResolverOptions install_ops = RelationshipResolver.DefaultOpts();
install_ops.with_recommends = false;

try
{
var initialChangeSet = new HashSet<ModChange>();
// Install the selected mod
initialChangeSet.Add(new ModChange(
new GUIMod(module, registry, CurrentInstance.VersionCriteria()),
GUIModChangeType.Install,
null
));
var userChangeSet = new List<ModChange>();
InstalledModule installed = registry.InstalledModule(module.identifier);
if (installed != null)
{
// Already installed, remove it first
initialChangeSet.Add(new ModChange(
userChangeSet.Add(new ModChange(
new GUIMod(installed.Module, registry, CurrentInstance.VersionCriteria()),
GUIModChangeType.Remove,
null
));
}
List<ModChange> fullChangeSet = new List<ModChange>(
await mainModList.ComputeChangeSetFromModList(
registry,
initialChangeSet,
ModuleInstaller.GetInstance(CurrentInstance, Manager.Cache, GUI.user),
CurrentInstance.VersionCriteria()
)
);
if (fullChangeSet != null && fullChangeSet.Count > 0)
// Install the selected mod
userChangeSet.Add(new ModChange(
new GUIMod(module, registry, CurrentInstance.VersionCriteria()),
GUIModChangeType.Install,
null
));
if (userChangeSet.Count > 0)
{
// Resolve the provides relationships in the dependencies
installWorker.RunWorkerAsync(
new KeyValuePair<List<ModChange>, RelationshipResolverOptions>(
fullChangeSet,
install_ops
userChangeSet,
RelationshipResolver.DependsOnlyOpts()
)
);
}
Expand Down

0 comments on commit 91c5bf4

Please sign in to comment.