Skip to content

Commit

Permalink
Merge pull request #1 from pjf/im_in_ur_pr83_changin_ur_files
Browse files Browse the repository at this point in the history
Fixups for PR KSP-CKAN#83
  • Loading branch information
AlexanderDzhoganov committed Oct 18, 2014
2 parents 1ebe501 + 8d2c1b4 commit 35bba3d
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 8 deletions.
6 changes: 3 additions & 3 deletions ModuleInstaller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -325,12 +325,12 @@ void InstallComponent (dynamic stanza, ZipFile zipfile, Dictionary<string, Insta
else if (stanza.install_to == "Tutorial")
{
installDir = Path.Combine(Path.Combine(KSP.GameDir(), "saves"), "training");
makeDirs = false;
makeDirs = true;
}
else if (stanza.install_to == "GameRoot")
{
installDir = KSP.GameDir();
makeDirs = true;
makeDirs = false;
} else {
// What is the best exception to use here??
throw new Exception("Unknown install location: " + stanza.install_to);
Expand Down Expand Up @@ -514,4 +514,4 @@ public ModuleNotFoundException (string mod, string ver = null) {
version = ver;
}
}
}
}
5 changes: 2 additions & 3 deletions Registry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,7 @@ public CkanModule LatestAvailable(string module, KSPVersion ksp_version = null)
return available_modules[module].Latest(ksp_version);
}
catch (KeyNotFoundException) {
return null;
// throw new ModuleNotFoundException(module);
throw new ModuleNotFoundException(module);
}
}

Expand Down Expand Up @@ -252,4 +251,4 @@ public bool IsInstalled(string modName) {
return true;
}
}
}
}
16 changes: 16 additions & 0 deletions RelationshipResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ public struct RelationshipResolverOptions {
public bool with_all_suggests;
}

// Alas, it appears that structs cannot have defaults. Try
// DefaultOpts() to get friendly defaults.

public class RelationshipResolver {

// A list of all the mods we're going to install.
Expand Down Expand Up @@ -49,6 +52,19 @@ public RelationshipResolver (List<string> modules, RelationshipResolverOptions o

}

/// <summary>
/// Returns the default options for relationship resolution.
/// </summary>
public static RelationshipResolverOptions DefaultOpts()
{
var opts = new RelationshipResolverOptions ();
opts.with_recommends = true;
opts.with_suggests = false;
opts.with_all_suggests = false;

return opts;
}

// Resolve all relationships for a module.
// May recurse to ResolveStanza.
private void Resolve(CkanModule module, RelationshipResolverOptions options) {
Expand Down
4 changes: 2 additions & 2 deletions Types/Version.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ struct Comparison {
public string remainder1;
public string remainder2;
}

public Version (string version_string) {
orig_string = version_string;
orig_string = version_string;

// TODO: Can we get rid of $1 here? Does C# support (?:syntax)?
Match match = Regex.Match (version_string, "^(([0-9]+):)?(.*)$");
Expand Down

0 comments on commit 35bba3d

Please sign in to comment.