diff -u -p -r1.197 nautilus-file-operations.c --- libnautilus-private/nautilus-file-operations.c 19 Sep 2005 15:50:57 -0000 1.197 +++ libnautilus-private/nautilus-file-operations.c 11 Oct 2005 11:03:38 -0000 @@ -1858,17 +1857,31 @@ nautilus_file_operations_copy_move (cons source_dir_uri = gnome_vfs_uri_get_parent (source_uri); target_uri = NULL; if (target_dir != NULL) { + GnomeVFSURI *trash_find_uri; + if (target_is_trash) { - result = gnome_vfs_find_directory (source_uri, GNOME_VFS_DIRECTORY_KIND_TRASH, + /* source_uri may be a symlink, which is resolved when finding the trash directory. + * Therefore, we use its parent dir if available */ + trash_find_uri = source_dir_uri != NULL ? source_dir_uri : source_uri; + g_assert (trash_find_uri != NULL); + + result = gnome_vfs_find_directory (trash_find_uri, + GNOME_VFS_DIRECTORY_KIND_TRASH, &target_dir_uri, FALSE, FALSE, 0777); - if (result == GNOME_VFS_ERROR_NOT_FOUND && source_dir_uri != NULL) { - /* source_uri may be a broken symlink */ - result = gnome_vfs_find_directory (source_dir_uri, GNOME_VFS_DIRECTORY_KIND_TRASH, - &target_dir_uri, FALSE, FALSE, 0777); - } - result = GNOME_VFS_OK; + if (result != GNOME_VFS_OK) { + char *trash_find_text_uri; + + g_assert (target_dir_uri == NULL); + + trash_find_text_uri = gnome_vfs_uri_to_string (trash_find_uri, GNOME_VFS_URI_HIDE_NONE); + g_warning ("Unable to find trash for \"%s\": %s. Please file a bug report.", + trash_find_text_uri, + gnome_vfs_result_to_string (result)); + g_free (trash_find_text_uri); + } } + if (target_dir_uri != NULL) { target_uri = append_basename (target_dir_uri, source_uri); }