mirror of
https://github.com/flatpak/flatpak.git
synced 2026-10-22 15:45:36 -04:00
lib: Return GBytes from xdg_app_installed_ref_load_metadata()
This is an ABI break, but nothing uses this yet.
This commit is contained in:
1 parent
faecde5da5
commit
ac851cae9e
3 files changed
+6
-5
No files matched your search
+1
-1
@@ -166,7 +166,7 @@ main (int argc, char *argv[])
|
||||
xdg_app_installed_ref_get_deploy_dir (app),
|
||||
xdg_app_installed_ref_get_is_current (app),
|
||||
xdg_app_installed_ref_get_installed_size (app));
|
||||
g_print ("metadata:\n%s\n", xdg_app_installed_ref_load_metadata (app, NULL, NULL));
|
||||
g_print ("metadata:\n%s\n", (char *)g_bytes_get_data (xdg_app_installed_ref_load_metadata (app, NULL, NULL), NULL));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -229,7 +229,7 @@ xdg_app_installed_ref_get_installed_size (XdgAppInstalledRef *self)
|
||||
return priv->installed_size;
|
||||
}
|
||||
|
||||
char *
|
||||
GBytes *
|
||||
xdg_app_installed_ref_load_metadata (XdgAppInstalledRef *self,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
@@ -237,6 +237,7 @@ xdg_app_installed_ref_load_metadata (XdgAppInstalledRef *self,
|
||||
XdgAppInstalledRefPrivate *priv = xdg_app_installed_ref_get_instance_private (self);
|
||||
g_autofree char *path = NULL;
|
||||
char *metadata;
|
||||
gsize length;
|
||||
|
||||
if (priv->deploy_dir == NULL)
|
||||
{
|
||||
@@ -246,10 +247,10 @@ xdg_app_installed_ref_load_metadata (XdgAppInstalledRef *self,
|
||||
}
|
||||
|
||||
path = g_build_filename (priv->deploy_dir, "metadata", NULL);
|
||||
if (!g_file_get_contents (path, &metadata, NULL, error))
|
||||
if (!g_file_get_contents (path, &metadata, &length, error))
|
||||
return NULL;
|
||||
|
||||
return metadata;
|
||||
return g_bytes_new_take (metadata, length);
|
||||
}
|
||||
|
||||
XdgAppInstalledRef *
|
||||
|
||||
@@ -53,7 +53,7 @@ XDG_APP_EXTERN guint64 xdg_app_installed_ref_get_installed_size (XdgAppInsta
|
||||
XDG_APP_EXTERN const char *xdg_app_installed_ref_get_deploy_dir (XdgAppInstalledRef *self);
|
||||
XDG_APP_EXTERN const char *xdg_app_installed_ref_get_latest_commit (XdgAppInstalledRef *self);
|
||||
XDG_APP_EXTERN gboolean xdg_app_installed_ref_get_is_current (XdgAppInstalledRef *self);
|
||||
XDG_APP_EXTERN char *xdg_app_installed_ref_load_metadata (XdgAppInstalledRef *self,
|
||||
XDG_APP_EXTERN GBytes *xdg_app_installed_ref_load_metadata (XdgAppInstalledRef *self,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
|
||||
Reference in new issue
Block a user