summaryrefslogtreecommitdiff
path: root/programs/gvfs-rm.c
diff options
context:
space:
mode:
Diffstat (limited to 'programs/gvfs-rm.c')
-rw-r--r--programs/gvfs-rm.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/programs/gvfs-rm.c b/programs/gvfs-rm.c
index cb666549..85f4fa04 100644
--- a/programs/gvfs-rm.c
+++ b/programs/gvfs-rm.c
@@ -1,5 +1,5 @@
/* GIO - GLib Input, Output and Streaming Library
- *
+ *
* Copyright (C) 2006-2007 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
@@ -24,11 +24,16 @@
#include <glib.h>
#include <locale.h>
+#include <glib/gi18n.h>
#include <gio/gio.h>
-static GOptionEntry entries[] =
+static gboolean force = FALSE;
+
+static GOptionEntry entries[] =
{
- { NULL }
+ {"force", 'f', 0, G_OPTION_ARG_NONE, &force,
+ N_("ignore nonexistent files, never prompt"), NULL},
+ { NULL }
};
@@ -38,27 +43,29 @@ main (int argc, char *argv[])
GError *error;
GOptionContext *context;
GFile *file;
-
+
setlocale (LC_ALL, "");
g_type_init ();
-
+
error = NULL;
- context = g_option_context_new ("- delete files");
+ context = g_option_context_new (_("- delete files"));
g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
g_option_context_parse (context, &argc, &argv, &error);
g_option_context_free (context);
-
+
if (argc > 1)
{
int i;
-
+
for (i = 1; i < argc; i++) {
file = g_file_new_for_commandline_arg (argv[i]);
error = NULL;
if (!g_file_delete (file, NULL, &error))
{
- g_print ("Error deleting file: %s\n", error->message);
+ if (!force ||
+ !g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_FOUND))
+ g_printerr ("Error deleting file: %s\n", error->message);
g_error_free (error);
}
g_object_unref (file);