+2007-12-03 Alexander Larsson <alexl@redhat.com>
+
+ * gfile.[ch]:
+ * glocalfile.c:
+ Add G_FILE_COPY_NO_FALLBACK_FOR_MOVE flag
+
2007-12-02 A. Walton <awalton@svn.gnome.org>
* gfile.c:
}
}
+ if (flags & G_FILE_COPY_NO_FALLBACK_FOR_MOVE)
+ {
+ g_set_error (error, G_IO_ERROR,
+ G_IO_ERROR_NOT_SUPPORTED,
+ _("Operation not supported"));
+ return FALSE;
+ }
+
flags |= G_FILE_COPY_ALL_METADATA;
if (!g_file_copy (source, destination, flags, cancellable,
progress_callback, progress_callback_data,
* @G_FILE_COPY_OVERWRITE: Overwrite any existing files
* @G_FILE_COPY_BACKUP: Make a backup of any existing files. TODO: explain backup naming scheme.
* @G_FILE_COPY_NOFOLLOW_SYMLINKS: Don't follow symlinks.
- * @G_FILE_COPY_ALL_METADATA: Copy all file metadata (see #GFileInfo).
+ * @G_FILE_COPY_ALL_METADATA: Copy all file metadata instead of just default set (see #GFileInfo).
+ * @G_FILE_COPY_NO_FALLBACK_FOR_MOVE: Don't use copy and delete fallback if native move not supported.
*
* Flags used when copying or moving files.
*/
G_FILE_COPY_OVERWRITE = (1<<0),
G_FILE_COPY_BACKUP = (1<<1),
G_FILE_COPY_NOFOLLOW_SYMLINKS = (1<<2),
- G_FILE_COPY_ALL_METADATA = (1<<3)
+ G_FILE_COPY_ALL_METADATA = (1<<3),
+ G_FILE_COPY_NO_FALLBACK_FOR_MOVE = (1<<4)
} GFileCopyFlags;
/**
if (rename (local_source->filename, local_destination->filename) == -1)
{
int errsv = errno;
- if (errsv == EXDEV)
- goto fallback;
- if (errsv == EINVAL)
+ if (errsv == EXDEV)
+ /* This will cause the fallback code to run */
+ g_set_error (error, G_IO_ERROR,
+ G_IO_ERROR_NOT_SUPPORTED,
+ _("Move between mounts not supported"));
+ else if (errsv == EINVAL)
/* This must be an invalid filename, on e.g. FAT, or
we're trying to move the file into itself...
We return invalid filename for both... */
}
return TRUE;
-
- fallback:
-
- if (!g_file_copy (source, destination, G_FILE_COPY_OVERWRITE | G_FILE_COPY_ALL_METADATA, cancellable,
- progress_callback, progress_callback_data,
- error))
- return FALSE;
-
- return g_file_delete (source, cancellable, error);
}
-
static GDirectoryMonitor*
g_local_file_monitor_dir (GFile *file,
GFileMonitorFlags flags,