Skip to content

Commit

Permalink
Determine which wrapper binary to use based on the available JREs
Browse files Browse the repository at this point in the history
Note: this code assumes a 64-bit wrapper binary is available, which is
true on new installs but may not be true on all installations until
updates can be pushed out through fred
  • Loading branch information
steveatinfincia committed Jul 11, 2017
1 parent 4d3a1a6 commit 73670c5
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 1 deletion.
9 changes: 9 additions & 0 deletions CommandsMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,15 @@ private void FindNode()
// dialog.
Log.Error(strings.MalformedConfig, e.Filename, e.Value);
MessageBox.Show(String.Format(strings.MalformedConfig, e.Filename, e.Value), "", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
catch (MissingJRE e)
{
// No JRE was found
FNLog.Error(strings.JRENotFound);
MessageBox.Show(strings.JRENotFound, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
/* Cannot continue for now */
Application.Exit();
return;
}
// TODO: Explain what happened to prompt a custom location?
try
Expand Down
17 changes: 16 additions & 1 deletion NodeController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,25 @@ public MissingConfigValueException(string filename, string value)
public int FProxyPort { get { return _config.FProxyPort; } }
public string DownloadsDir { get { return _config.DownloadsDir; } }

public const string WrapperFilename = @"wrapper\freenetwrapper.exe";
private const string FreenetIniFilename = @"freenet.ini";
private const string WrapperConfFilename = "wrapper.conf";

public static string WrapperFilename {
get {
switch (MachineConfig.GetBestAvailableJRE) {
case JREType.JRE64Bit:
return @"wrapper\freenetwrapper-64.exe";
case JREType.JRE32Bit:
return @"wrapper\freenetwrapper.exe";
case JREType.None:
// there is no JRE installed at all
throw new MissingJRE();
default:
throw new MissingJRE();
}
}
}

// TODO: Where to document? Thows FileNotFound; DirectoryNotFound
public NodeController()
{
Expand Down
9 changes: 9 additions & 0 deletions strings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions strings.resx
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@
<data name="FreenetStarting" xml:space="preserve">
<value>Freenet is starting.</value>
</data>
<data name="JRENotFound" xml:space="preserve">
<value>No Java runtime is available</value>
</data>
<data name="MalformedConfig" xml:space="preserve">
<value>The configuration file '{0}' does not contain a valid value for '{1}'.</value>
</data>
Expand Down

0 comments on commit 73670c5

Please sign in to comment.