Skip to content

Commit

Permalink
Merge #2793 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
2 parents 77a3bea + 91c5bf4 commit 4b61ee2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 22 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ All notable changes to this project will be documented in this file.
- [Core] Suppress autostart warning (#2776 by: HebaruSan; reviewed: DasSkelett)
- [Netkan] Skip comments and allow capital letters in locale extractor (#2783 by: HebaruSan; reviewed: DasSkelett)
- [GUI] Fix UK spelling of licence (#2794 by: HebaruSan; reviewed: DasSkelett)
- [GUI] Mark auto-install correctly when installing from .ckan file (#2793 by: HebaruSan; reviewed: DasSkelett)

### Internal
- [Build] Update packages (#2775 by: Olympic1; reviewed: DasSkelett, HebaruSan)
Expand Down
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 4b61ee2

Please sign in to comment.