diff --git a/common/flatpak-utils.c b/common/flatpak-utils.c index 4a8db0f98..23fe68836 100644 --- a/common/flatpak-utils.c +++ b/common/flatpak-utils.c @@ -2054,6 +2054,35 @@ flatpak_spawnv (GFile *dir, return TRUE; } +GFile * +flatpak_build_file_va (GFile *base, + va_list args) +{ + g_autoptr(GFile) res = g_object_ref (base); + const gchar *arg; + + while ((arg = va_arg (args, const gchar *))) + { + GFile *child = g_file_get_child (res, arg); + g_set_object (&res, child); + } + + return g_steal_pointer (&res); +} + +GFile * +flatpak_build_file (GFile *base, ...) +{ + GFile *res; + va_list args; + + va_start (args, base); + res = flatpak_build_file_va (base, args); + va_end (args); + + return res; +} + const char * flatpak_file_get_path_cached (GFile *file) { diff --git a/common/flatpak-utils.h b/common/flatpak-utils.h index 4f806f7db..40a2c1ba7 100644 --- a/common/flatpak-utils.h +++ b/common/flatpak-utils.h @@ -399,6 +399,10 @@ gboolean flatpak_spawnv (GFile *dir, const char *flatpak_file_get_path_cached (GFile *file); +GFile *flatpak_build_file_va (GFile *base, + va_list args); +GFile *flatpak_build_file (GFile *base, ...) G_GNUC_NULL_TERMINATED; + gboolean flatpak_openat_noatime (int dfd, const char *name, int *ret_fd,