[gnumeric] solver: use better error messages when missing solver executables.
- From: Morten Welinder <mortenw src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnumeric] solver: use better error messages when missing solver executables.
- Date: Tue, 1 Dec 2009 18:37:29 +0000 (UTC)
commit 48ab60b5bde0327a4368732b01a13767b0d4b747
Author: Morten Welinder <terra gnome org>
Date: Tue Dec 1 13:37:01 2009 -0500
solver: use better error messages when missing solver executables.
plugins/glpk/gnm-glpk.c | 12 ++++++++++++
plugins/lpsolve/gnm-lpsolve.c | 12 ++++++++++++
2 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/plugins/glpk/gnm-glpk.c b/plugins/glpk/gnm-glpk.c
index 04f7437..56b0bdb 100644
--- a/plugins/glpk/gnm-glpk.c
+++ b/plugins/glpk/gnm-glpk.c
@@ -15,6 +15,7 @@
#include <unistd.h>
#define SOLVER_PROGRAM "glpsol"
+#define SOLVER_URL "http://www.gnu.org/software/glpk/"
#define PRIVATE_KEY "::glpk::"
typedef struct {
@@ -277,6 +278,17 @@ gnm_glpk_start (GnmSolver *sol, WorkbookControl *wbc, GError **err,
NULL, NULL,
err);
+ if (!ok && err &&
+ g_error_matches (*err, G_SPAWN_ERROR, G_SPAWN_ERROR_NOENT)) {
+ g_clear_error (err);
+ g_set_error (err, G_SPAWN_ERROR, G_SPAWN_ERROR_NOENT,
+ _("The %s program was not found. You can either "
+ "install it or use another solver. "
+ "For more information see %s"),
+ SOLVER_PROGRAM,
+ SOLVER_URL);
+ }
+
return ok;
}
diff --git a/plugins/lpsolve/gnm-lpsolve.c b/plugins/lpsolve/gnm-lpsolve.c
index 9926ad0..4d89630 100644
--- a/plugins/lpsolve/gnm-lpsolve.c
+++ b/plugins/lpsolve/gnm-lpsolve.c
@@ -10,6 +10,7 @@
#include <string.h>
#define SOLVER_PROGRAM "lp_solve"
+#define SOLVER_URL "http://sourceforge.net/projects/lpsolve/"
#define PRIVATE_KEY "::lpsolve::"
typedef struct {
@@ -272,6 +273,17 @@ gnm_lpsolve_start (GnmSolver *sol, WorkbookControl *wbc, GError **err,
NULL, NULL,
err);
+ if (!ok && err &&
+ g_error_matches (*err, G_SPAWN_ERROR, G_SPAWN_ERROR_NOENT)) {
+ g_clear_error (err);
+ g_set_error (err, G_SPAWN_ERROR, G_SPAWN_ERROR_NOENT,
+ _("The %s program was not found. You can either "
+ "install it or use another solver. "
+ "For more information see %s"),
+ SOLVER_PROGRAM,
+ SOLVER_URL);
+ }
+
return ok;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]