Add flatpak_file_rename

Closes: #98
Approved by: alexlarsson
tingping/wmclass
Alexander Larsson 2018-01-11 09:36:00 +01:00 committed by Atomic Bot
parent cd0c9da8f3
commit 9b4f14cd45
2 changed files with 22 additions and 0 deletions

View File

@ -897,6 +897,23 @@ flatpak_rm_rf (GFile *dir,
cancellable, error);
}
gboolean flatpak_file_rename (GFile *from,
GFile *to,
GCancellable *cancellable,
GError **error)
{
if (g_cancellable_set_error_if_cancelled (cancellable, error))
return FALSE;
if (rename (flatpak_file_get_path_cached (from),
flatpak_file_get_path_cached (to)) < 0)
{
glnx_set_error_from_errno (error);
return FALSE;
}
return TRUE;
}
#define OSTREE_GIO_FAST_QUERYINFO ("standard::name,standard::type,standard::size,standard::is-symlink,standard::symlink-target," \
"unix::device,unix::inode,unix::mode,unix::uid,unix::gid,unix::rdev")

View File

@ -221,6 +221,11 @@ GFile *flatpak_build_file_va (GFile *base,
va_list args);
GFile *flatpak_build_file (GFile *base, ...) G_GNUC_NULL_TERMINATED;
gboolean flatpak_file_rename (GFile *from,
GFile *to,
GCancellable *cancellable,
GError **error);
gboolean flatpak_openat_noatime (int dfd,
const char *name,
int *ret_fd,