[nautilus/wip/rishi/gfile-google: 2/2] file-operations: Let directory copy / move work on Google Drive
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/rishi/gfile-google: 2/2] file-operations: Let directory copy / move work on Google Drive
- Date: Mon, 7 Sep 2015 12:58:41 +0000 (UTC)
commit 6da826722ad8748401c32d3a705db896aca91bf8
Author: Debarshi Ray <debarshir gnome org>
Date: Mon Sep 7 14:53:27 2015 +0200
file-operations: Let directory copy / move work on Google Drive
When recursively copying and moving directories, the destination has
to be created if it doesn't already exist. Immediately check if the
newly created directory is volatile or not, and if it is then switch
to using the "real" persistent URI.
https://bugzilla.gnome.org/show_bug.cgi?id=751481
libnautilus-private/nautilus-file-operations.c | 36 +++++++++++++++++++++++-
1 files changed, 35 insertions(+), 1 deletions(-)
---
diff --git a/libnautilus-private/nautilus-file-operations.c b/libnautilus-private/nautilus-file-operations.c
index 0d8d651..444afe6 100644
--- a/libnautilus-private/nautilus-file-operations.c
+++ b/libnautilus-private/nautilus-file-operations.c
@@ -3729,6 +3729,7 @@ create_dest_dir (CommonJob *job,
char *primary, *secondary, *details;
int response;
gboolean handled_invalid_filename;
+ gboolean res;
handled_invalid_filename = *dest_fs_type != NULL;
@@ -3737,7 +3738,40 @@ create_dest_dir (CommonJob *job,
copying the attributes, because we need to be sure we can write to it */
error = NULL;
- if (!g_file_make_directory (*dest, job->cancellable, &error)) {
+ res = g_file_make_directory (*dest, job->cancellable, &error);
+
+#ifdef G_FILE_ATTRIBUTE_STANDARD_IS_VOLATILE
+ if (res) {
+ GFileInfo *info = NULL;
+
+ info = g_file_query_info (*dest,
+ G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK","
+ G_FILE_ATTRIBUTE_STANDARD_IS_VOLATILE","
+ G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET,
+ G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
+ job->cancellable,
+ &error);
+ if (info == NULL) {
+ res = FALSE;
+ } else {
+ gboolean is_volatile;
+
+ is_volatile = g_file_info_get_attribute_boolean (info,
+
G_FILE_ATTRIBUTE_STANDARD_IS_VOLATILE);
+ if (is_volatile) {
+ const gchar *target;
+
+ target = g_file_info_get_symlink_target (info);
+ g_object_unref (*dest);
+ *dest = g_file_new_for_uri (target);
+ }
+ }
+
+ g_clear_object (&info);
+ }
+#endif /* G_FILE_ATTRIBUTE_STANDARD_IS_VOLATILE */
+
+ if (!res) {
if (IS_IO_ERROR (error, CANCELLED)) {
g_error_free (error);
return CREATE_DEST_DIR_FAILED;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]