[chronojump] If graph crashes alert that R is not installed



commit bb5c7a8d72c92aaa48a639b592a8e2a846e92095
Author: Xavier de Blas <xaviblas gmail com>
Date:   Sun Jan 6 13:40:00 2013 +0100

    If graph crashes alert that R is not installed

 src/stats/main.cs |    5 ++++-
 src/util.cs       |    6 +++++-
 2 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/src/stats/main.cs b/src/stats/main.cs
index 77ab925..78636b2 100644
--- a/src/stats/main.cs
+++ b/src/stats/main.cs
@@ -1465,7 +1465,10 @@ public class Stat
 
 		if(show) {
 			if(! File.Exists(fileName) || File.GetLastWriteTime(fileName) < File.GetLastWriteTime(rScript))
-				new DialogMessage(Constants.MessageTypes.WARNING, "Sorry. Error doing graph");
+				new DialogMessage(Constants.MessageTypes.WARNING, 
+						Catalog.GetString("Sorry. Error doing graph.") + 
+						"\n" + Catalog.GetString("Maybe R is not installed.") + 
+						"\n\nhttp://www.r-project.org/";);
 			else
 				new DialogImageTest(Catalog.GetString("Chronojump Graph"), fileName);
 		}
diff --git a/src/util.cs b/src/util.cs
index ad0bea6..ea4a395 100644
--- a/src/util.cs
+++ b/src/util.cs
@@ -993,12 +993,16 @@ public class Util
 		pinfo.Arguments ="CMD BATCH --no-save " + rScript +" " + outputFile;
 		pinfo.CreateNoWindow = true;
 		pinfo.UseShellExecute = false;
-		
+	
+		try {	
 		r = new Process();
 		r.StartInfo = pinfo;
 		r.Start();
 		r.WaitForExit();
 		while ( ! ( File.Exists(outputFile) || CancelRScript) );
+		} catch {
+			//maybe R is not installed
+		}
 	}
 	
 	//python program



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]