diff options
author | Alexander Larsson <alexl@src.gnome.org> | 2007-09-13 14:07:58 +0000 |
---|---|---|
committer | Alexander Larsson <alexl@src.gnome.org> | 2007-09-13 14:07:58 +0000 |
commit | 965241baaf2a30bd45cc8c42b600089e19e772c0 (patch) | |
tree | b5054d6f51424053a86ea5eebd76b3b83d5da890 /programs | |
parent | 61ea6d2eb6e2f455ff25a4269991187d8f9a5e81 (diff) |
Add -T argument
Original git commit by Alexander Larsson <alexl@redhat.com> at 1183562927 +0200
svn path=/trunk/; revision=632
Diffstat (limited to 'programs')
-rw-r--r-- | programs/gvfs-copy.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/programs/gvfs-copy.c b/programs/gvfs-copy.c index db1f6e27..1d4eb528 100644 --- a/programs/gvfs-copy.c +++ b/programs/gvfs-copy.c @@ -12,9 +12,11 @@ static gboolean progress = FALSE; static gboolean interactive = FALSE; static gboolean backup = FALSE; +static gboolean no_target_directory = FALSE; static GOptionEntry entries[] = { + { "no-target-directory", 'T', 0, G_OPTION_ARG_NONE, &no_target_directory, "no target directory", NULL }, { "progress", 'p', 0, G_OPTION_ARG_NONE, &progress, "show progress", NULL }, { "interactive", 'i', 0, G_OPTION_ARG_NONE, &interactive, "prompt before overwrite", NULL }, { "backup", 'b', 0, G_OPTION_ARG_NONE, &backup, "backup existing destination files", NULL }, @@ -72,6 +74,13 @@ main (int argc, char *argv[]) dest = g_file_get_for_commandline_arg (argv[argc-1]); + if (no_target_directory && argc > 3) + { + g_printerr ("Too many arguments\n"); + g_object_unref (dest); + return 1; + } + dest_is_dir = is_dir (dest); if (!dest_is_dir && argc > 3) @@ -85,7 +94,7 @@ main (int argc, char *argv[]) { source = g_file_get_for_commandline_arg (argv[i]); - if (dest_is_dir) + if (dest_is_dir && !no_target_directory) { basename = g_file_get_basename (source); target = g_file_get_child (dest, basename); |