From 9dfce3a26a37c46cb00d323230ed0885c43b55f1 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Thu, 27 Mar 2008 20:13:00 +0000 Subject: [PATCH] Return G_IO_ERROR_IS_DIRECTORY, not G_IO_ERROR_WOULD_MERGE when moving 2008-03-27 Alexander Larsson * glocalfile.c (g_local_file_move): Return G_IO_ERROR_IS_DIRECTORY, not G_IO_ERROR_WOULD_MERGE when moving file over directory. This is according to the docs and what the move via copy+remove fallback does. svn path=/trunk/; revision=6758 --- gio/ChangeLog | 7 +++++++ gio/glocalfile.c | 17 +++++++++++------ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/gio/ChangeLog b/gio/ChangeLog index 5672475..3365ced 100644 --- a/gio/ChangeLog +++ b/gio/ChangeLog @@ -1,3 +1,10 @@ +2008-03-27 Alexander Larsson + + * glocalfile.c (g_local_file_move): + Return G_IO_ERROR_IS_DIRECTORY, not G_IO_ERROR_WOULD_MERGE when moving + file over directory. This is according to the docs and what the move via + copy+remove fallback does. + 2008-03-27 Lin Ma * fen/*.[hc]: Updated copyright. diff --git a/gio/glocalfile.c b/gio/glocalfile.c index 03e8669..529d808 100644 --- a/gio/glocalfile.c +++ b/gio/glocalfile.c @@ -2078,9 +2078,8 @@ g_local_file_move (GFile *source, g_strerror (errsv)); return FALSE; } - else - source_is_dir = S_ISDIR (statbuf.st_mode); + source_is_dir = S_ISDIR (statbuf.st_mode); source_size = statbuf.st_size; destination_exist = FALSE; @@ -2094,10 +2093,16 @@ g_local_file_move (GFile *source, /* Always fail on dirs, even with overwrite */ if (S_ISDIR (statbuf.st_mode)) { - g_set_error (error, - G_IO_ERROR, - G_IO_ERROR_WOULD_MERGE, - _("Can't move directory over directory")); + if (source_is_dir) + g_set_error (error, + G_IO_ERROR, + G_IO_ERROR_WOULD_MERGE, + _("Can't move directory over directory")); + else + g_set_error (error, + G_IO_ERROR, + G_IO_ERROR_IS_DIRECTORY, + _("File is directory")); return FALSE; } } -- 2.7.4