mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-09-07 00:18:44 +02:00
Add G_FILE_COPY_NO_FALLBACK_FOR_MOVE flag
2007-12-03 Alexander Larsson <alexl@redhat.com> * gfile.[ch]: * glocalfile.c: Add G_FILE_COPY_NO_FALLBACK_FOR_MOVE flag svn path=/trunk/; revision=6015
This commit is contained in:
committed by
Alexander Larsson
parent
6f605509fd
commit
6394ae6fdb
@@ -1746,10 +1746,13 @@ g_local_file_move (GFile *source,
|
||||
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... */
|
||||
@@ -1765,18 +1768,8 @@ g_local_file_move (GFile *source,
|
||||
|
||||
}
|
||||
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,
|
||||
|
Reference in New Issue
Block a user