[GRASS-SVN] r66914 - grass/trunk/lib/gis
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Nov 24 07:56:08 PST 2015
Author: martinl
Date: 2015-11-24 07:56:08 -0800 (Tue, 24 Nov 2015)
New Revision: 66914
Modified:
grass/trunk/lib/gis/parser.c
Log:
libgis: fix parser when GUI is not available and asked by user
Modified: grass/trunk/lib/gis/parser.c
===================================================================
--- grass/trunk/lib/gis/parser.c 2015-11-24 15:47:13 UTC (rev 66913)
+++ grass/trunk/lib/gis/parser.c 2015-11-24 15:56:08 UTC (rev 66914)
@@ -119,7 +119,7 @@
static int check_overwrite(void);
static void define_keywords(void);
static void split_gisprompt(const char *, char *, char *, char *);
-static void module_gui_wx(void);
+static int module_gui_wx(void);
static void append_error(const char *);
static const char *get_renamed_option(const char *);
@@ -433,10 +433,11 @@
if (argc < 2 && (st->has_required || G__has_required_rule())
&& !st->no_interactive && isatty(0)) {
- module_gui_wx();
- return -1;
+ if (module_gui_wx() == 0)
+ return -1;
}
- else if (argc < 2 && st->has_required && isatty(0)) {
+
+ if (argc < 2 && st->has_required && isatty(0)) {
G_usage();
return -1;
}
@@ -573,7 +574,8 @@
/* Run the gui if it was specifically requested */
if (force_gui) {
- module_gui_wx();
+ if (module_gui_wx() != 0)
+ G_fatal_error(_("Your installation doesn't include GUI, exiting."));
return -1;
}
@@ -826,7 +828,7 @@
/*!
\brief Invoke GUI dialog
*/
-void module_gui_wx(void)
+int module_gui_wx(void)
{
char script[GPATH_MAX];
@@ -836,8 +838,14 @@
G_fatal_error(_("Unable to determine program name"));
sprintf(script, "%s/gui/wxpython/gui_core/forms.py",
- getenv("GISBASE"));
- G_spawn(getenv("GRASS_PYTHON"), getenv("GRASS_PYTHON"), script, G_recreate_command(), NULL);
+ getenv("GISBASE"));
+ if (access(script, F_OK) != -1)
+ G_spawn(getenv("GRASS_PYTHON"), getenv("GRASS_PYTHON"),
+ script, G_recreate_command(), NULL);
+ else
+ return -1;
+
+ return 0;
}
void set_flag(int f)
More information about the grass-commit
mailing list