瀏覽代碼

Existing map case: improve overwrite user msg

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@65853 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Neteler 9 年之前
父節點
當前提交
97c69c517d
共有 6 個文件被更改,包括 12 次插入7 次删除
  1. 1 1
      display/d.mon/start.c
  2. 6 2
      lib/gis/parser.c
  3. 1 1
      raster/r.mapcalc/evaluate.c
  4. 2 1
      raster/r.proj/main.c
  5. 1 1
      vector/v.external/main.c
  6. 1 1
      vector/v.proj/main.c

+ 1 - 1
display/d.mon/start.c

@@ -41,7 +41,7 @@ char *start(const char *name, const char *output, int update)
             }
             else {
                 D_close_driver();
-                G_fatal_error(_("option <%s>: <%s> exists."),
+                G_fatal_error(_("option <%s>: <%s> exists. To overwrite, use the --overwrite flag"),
                               "output", output_name);
             }
         }

+ 6 - 2
lib/gis/parser.c

@@ -1469,14 +1469,18 @@ int check_overwrite(void)
 			if (!st->overwrite && !over) {
                             if (G_verbose() > -1) {
                                 if (G_info_format() != G_INFO_FORMAT_GUI) {
+                                    fprintf(stderr, _("ERROR: "));
                                     fprintf(stderr,
-                                            _("ERROR: option <%s>: <%s> exists.\n"),
+                                            _("option <%s>: <%s> exists. To overwrite, use the --overwrite flag"),
                                             opt->key, opt->answers[i]);
+                                    fprintf(stderr, "\n");
                                 }
                                 else {
+                                    fprintf(stderr, _("GRASS_INFO_ERROR(%d,1): "));
                                     fprintf(stderr,
-                                            "GRASS_INFO_ERROR(%d,1): option <%s>: <%s> exists.\n",
+                                            "option <%s>: <%s> exists. To overwrite, use the --overwrite flag",
                                             getpid(), opt->key, opt->answers[i]);
+                                    fprintf(stderr, "\n");
                                     fprintf(stderr, "GRASS_INFO_END(%d,1)\n",
                                             getpid());
                                 }

+ 1 - 1
raster/r.mapcalc/evaluate.c

@@ -279,7 +279,7 @@ void execute(expr_list * ee)
 	var = e->data.bind.var;
 
 	if (!overwrite_flag && check_output_map(var))
-	    G_fatal_error(_("output map <%s> exists"), var);
+	    G_fatal_error(_("output map <%s> exists. To overwrite, use the --overwrite flag"), var);
     }
 
     for (l = ee; l; l = l->next) {

+ 2 - 1
raster/r.proj/main.c

@@ -242,7 +242,8 @@ int main(int argc, char **argv)
     if (mapname && !list->answer && !overwrite &&
 	!print_bounds->answer && !gprint_bounds->answer &&
 	G_find_raster(mapname, G_mapset()))
-	G_fatal_error(_("option <%s>: <%s> exists."), "output", mapname);
+	G_fatal_error(_("option <%s>: <%s> exists. To overwrite, use the --overwrite flag"),
+                      "output", mapname);
 
     setname = imapset->answer ? imapset->answer : G_store(G_mapset());
     if (strcmp(inlocation->answer, G_location()) == 0 &&

+ 1 - 1
vector/v.external/main.c

@@ -136,7 +136,7 @@ int main(int argc, char *argv[])
     G_debug(2, "layer '%s' was found", options.layer->answer);
 
     if (G_find_vector2(output, G_mapset()) && !G_check_overwrite(argc, argv)) {
-        G_fatal_error(_("option <%s>: <%s> exists."),
+        G_fatal_error(_("option <%s>: <%s> exists. To overwrite, use the --overwrite flag"),
                       options.output->key, output);
     }
     

+ 1 - 1
vector/v.proj/main.c

@@ -141,7 +141,7 @@ int main(int argc, char *argv[])
 	omap_name = map_name;
     if (omap_name && !flag.list->answer && !overwrite &&
 	G_find_vector2(omap_name, G_mapset()))
-	G_fatal_error(_("option <%s>: <%s> exists."), omapopt->key,
+	G_fatal_error(_("option <%s>: <%s> exists. To overwrite, use the --overwrite flag"), omapopt->key,
 		      omap_name);
     if (isetopt->answer)
 	iset_name = isetopt->answer;