diff options
-rw-r--r-- | man/gvfs-save.xml | 11 | ||||
-rw-r--r-- | programs/gvfs-save.c | 3 |
2 files changed, 14 insertions, 0 deletions
diff --git a/man/gvfs-save.xml b/man/gvfs-save.xml index ef188f9a..822e6a44 100644 --- a/man/gvfs-save.xml +++ b/man/gvfs-save.xml @@ -95,6 +95,17 @@ </varlistentry> <varlistentry> + <term><option>-u</option>, <option>--unlink</option></term> + + <listitem> + <para>When replacing an existing file, + replace the destination as if it does + not exist. Think of it as unlinking + the destination before writing.</para> + </listitem> + </varlistentry> + + <varlistentry> <term><option>-v</option>, <option>--print-etag</option></term> <listitem><para>Print the new etag at the end.</para></listitem> diff --git a/programs/gvfs-save.c b/programs/gvfs-save.c index 51f70b1f..8a1c6145 100644 --- a/programs/gvfs-save.c +++ b/programs/gvfs-save.c @@ -36,6 +36,7 @@ static gboolean backup = FALSE; static gboolean create = FALSE; static gboolean append = FALSE; static gboolean priv = FALSE; +static gboolean replace_dest = FALSE; static gboolean print_etag = FALSE; static gboolean show_version = FALSE; @@ -45,6 +46,7 @@ static GOptionEntry entries[] = { "create", 'c', 0, G_OPTION_ARG_NONE, &create, N_("Only create if not existing"), NULL }, { "append", 'a', 0, G_OPTION_ARG_NONE, &append, N_("Append to end of file"), NULL }, { "private", 'p', 0, G_OPTION_ARG_NONE, &priv, N_("When creating, restrict access to the current user"), NULL }, + { "unlink", 'u', 0, G_OPTION_ARG_NONE, &replace_dest, N_("When replacing, replace as if the destination did not exist"), NULL }, /* Translators: The "etag" is a token allowing to verify whether a file has been modified */ { "print-etag", 'v', 0, G_OPTION_ARG_NONE, &print_etag, N_("Print new etag at end"), NULL }, /* Translators: The "etag" is a token allowing to verify whether a file has been modified */ @@ -68,6 +70,7 @@ save (GFile *file) error = NULL; flags = priv ? G_FILE_CREATE_PRIVATE : G_FILE_CREATE_NONE; + flags |= replace_dest ? G_FILE_CREATE_REPLACE_DESTINATION : 0; if (create) out = (GOutputStream *)g_file_create (file, flags, NULL, &error); |