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

Mark auto-install correctly when installing from .ckan file #2793

Merged
merged 1 commit into from
Jun 22, 2019
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
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