robocode (1.6.2+dfsg-3) 03-point-api-help-to-robocode-doc.diff

Summary

 robocode/robocode/editor/RobocodeEditor.java |    9 +++++++--
 robocode/robocode/manager/WindowManager.java |    9 ++++++---
 2 files changed, 13 insertions(+), 5 deletions(-)

    
download this patch

Patch contents

## 03-point-api-help-to-robocode-doc.diff by Chris Lamb <chris@chris-lamb.co.uk>
##
## Ensure that "Robocode API" entries in the GUI load from the correct place,
## or display a message detailing how to obtain the documentation.

diff -urNad robocode~/robocode/robocode/manager/WindowManager.java robocode/robocode/robocode/manager/WindowManager.java
--- robocode~/robocode/robocode/manager/WindowManager.java	2007-09-24 00:31:38.000000000 +0100
+++ robocode/robocode/robocode/manager/WindowManager.java	2007-12-21 14:56:39.000000000 +0000
@@ -136,9 +136,12 @@
 	}
 
 	public void showHelpApi() {
-		showInBrowser(
-				"file://" + new File(FileUtil.getCwd(), "").getAbsoluteFile() + System.getProperty("file.separator")
-				+ "javadoc" + System.getProperty("file.separator") + "index.html");
+		File f = new File("/usr/share/doc/robocode-doc/html/index.html");
+		if (f.exists()) {
+			showInBrowser(f.toString());
+		} else {
+			showInBrowser("/usr/share/doc/robocode/html/missing-documentation.html");
+		}
 	}
 
 	public void showFaq() {
diff -urNad robocode~/robocode/robocode/editor/RobocodeEditor.java robocode/robocode/robocode/editor/RobocodeEditor.java
--- robocode~/robocode/robocode/editor/RobocodeEditor.java	2007-11-19 22:58:58.000000000 +0000
+++ robocode/robocode/robocode/editor/RobocodeEditor.java	2007-12-21 16:22:07.000000000 +0000
@@ -763,8 +763,13 @@
 	}
 
 	public void showHelpApi() {
-		String helpurl = "file:" + new File(FileUtil.getCwd(), "").getAbsoluteFile() // System.getProperty("user.dir")
-				+ System.getProperty("file.separator") + "javadoc" + System.getProperty("file.separator") + "index.html";
+		String helpurl;
+		File f = new File("/usr/share/doc/robocode-doc/html/index.html");
+		if (f.exists()) {
+			helpurl = "file:" + f.toString();
+		} else {
+			helpurl = "file:" + "/usr/share/doc/robocode/html/missing-documentation.html";
+		}
 
 		try {
 			BrowserManager.openURL(helpurl);