[GRASS-SVN] r44437 - grass/trunk/lib/gis
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Nov 26 13:36:51 EST 2010
Author: martinl
Date: 2010-11-26 10:36:51 -0800 (Fri, 26 Nov 2010)
New Revision: 44437
Modified:
grass/trunk/lib/gis/parser.c
grass/trunk/lib/gis/parser_standard_options.c
Log:
libgis: check also file if exists
Modified: grass/trunk/lib/gis/parser.c
===================================================================
--- grass/trunk/lib/gis/parser.c 2010-11-26 18:23:07 UTC (rev 44436)
+++ grass/trunk/lib/gis/parser.c 2010-11-26 18:36:51 UTC (rev 44437)
@@ -1287,8 +1287,18 @@
if (strcmp(age, "new") == 0) {
int i;
+ char found = FALSE;
for (i = 0; opt->answers[i]; i++) {
- if (G_find_file(element, opt->answers[i], G_mapset())) { /* found */
+ if (strcmp(element, "file") == 0) {
+ if (access(opt->answers[i], F_OK) == 0) {
+ found = TRUE;
+ }
+ }
+ else {
+ if(G_find_file(element, opt->answers[i], G_mapset()))
+ found = TRUE;
+ }
+ if (found) { /* found */
if (!st->overwrite && !over) {
if (G_info_format() != G_INFO_FORMAT_GUI) {
fprintf(stderr,
Modified: grass/trunk/lib/gis/parser_standard_options.c
===================================================================
--- grass/trunk/lib/gis/parser_standard_options.c 2010-11-26 18:23:07 UTC (rev 44436)
+++ grass/trunk/lib/gis/parser_standard_options.c 2010-11-26 18:36:51 UTC (rev 44437)
@@ -113,7 +113,7 @@
Opt->required = NO;
Opt->multiple = NO;
Opt->description = _("Table name");
- Opt->gisprompt = "old_dbtable,dbtable,dbtable";
+ Opt->gisprompt = "old,dbtable,dbtable";
break;
case G_OPT_DB_DRIVER:
Opt->key = "driver";
@@ -122,7 +122,7 @@
Opt->required = NO;
Opt->multiple = NO;
Opt->description = _("Driver name");
- Opt->gisprompt = "old_dbdriver,dbdriver,dbdriver";
+ Opt->gisprompt = "old,dbdriver,dbdriver";
break;
case G_OPT_DB_DATABASE:
Opt->key = "database";
@@ -131,7 +131,7 @@
Opt->required = NO;
Opt->multiple = NO;
Opt->description = _("Database name");
- Opt->gisprompt = "old_dbname,dbname,dbname";
+ Opt->gisprompt = "old,dbname,dbname";
break;
case G_OPT_DB_SCHEMA:
Opt->key = "schema";
@@ -150,7 +150,7 @@
Opt->required = NO;
Opt->multiple = NO;
Opt->description = _("Name of attribute column");
- Opt->gisprompt = "old_dbcolumn,dbcolumn,dbcolumn";
+ Opt->gisprompt = "old,dbcolumn,dbcolumn";
break;
case G_OPT_DB_COLUMNS:
Opt->key = "columns";
@@ -159,7 +159,7 @@
Opt->required = NO;
Opt->multiple = YES;
Opt->description = _("Name of attribute column(s)");
- Opt->gisprompt = "old_dbcolumn,dbcolumn,dbcolumn";
+ Opt->gisprompt = "old,dbcolumn,dbcolumn";
break;
/* imagery group */
@@ -375,7 +375,7 @@
_("A single vector map can be connected to multiple database "
"tables. This number determines which table to use. "
"Layer name for OGR access.");
- Opt->gisprompt = "old_layer,layer,layer";
+ Opt->gisprompt = "old,layer,layer";
break;
case G_OPT_V_FIELD_ALL:
Opt->key = "layer";
@@ -387,7 +387,7 @@
_("A single vector map can be connected to multiple database "
"tables. This number determines which table to use. "
"Layer name for OGR access.");
- Opt->gisprompt = "old_layer,layer,layer_all";
+ Opt->gisprompt = "old,layer,layer_all";
break;
case G_OPT_V_CAT:
Opt->key = "cat";
@@ -424,7 +424,7 @@
Opt->type = TYPE_STRING;
Opt->key_desc = "path";
Opt->required = YES;
- Opt->gisprompt = "old_file,file,input";
+ Opt->gisprompt = "old,file,input";
Opt->description = _("Path to input file");
break;
case G_OPT_F_OUTPUT:
@@ -432,7 +432,7 @@
Opt->type = TYPE_STRING;
Opt->key_desc = "path";
Opt->required = YES;
- Opt->gisprompt = "new_file,file,output";
+ Opt->gisprompt = "new,file,output";
Opt->description = _("Path for output file");
break;
case G_OPT_F_SEP:
@@ -452,7 +452,7 @@
Opt->key_desc = "name";
Opt->required = NO;
Opt->answer = DEFAULT_FG_COLOR;
- Opt->gisprompt = "old_color,color,color";
+ Opt->gisprompt = "old,color,color";
Opt->label = _("Color");
Opt->description = _("Either a standard color name or R:G:B triplet");
break;
@@ -462,7 +462,7 @@
Opt->key_desc = "name";
Opt->required = NO;
Opt->answer = DEFAULT_BG_COLOR;
- Opt->gisprompt = "old_color,color,color_none";
+ Opt->gisprompt = "old,color,color_none";
Opt->label = _("Background color");
Opt->description =
_("Either a standard GRASS color, R:G:B triplet, or \"none\"");
More information about the grass-commit
mailing list