core: Add public API to get the path for an object

This commit is contained in:
Colin Walters 2011-11-08 19:38:42 -05:00
parent 8f0afd1f54
commit d14568dd2a
2 changed files with 12 additions and 13 deletions

View File

@ -29,11 +29,6 @@
#include <gio/gunixoutputstream.h> #include <gio/gunixoutputstream.h>
#include <gio/gunixinputstream.h> #include <gio/gunixinputstream.h>
static char *
get_object_path (OstreeRepo *self,
const char *checksum,
OstreeObjectType type);
enum { enum {
PROP_0, PROP_0,
@ -731,8 +726,8 @@ import_directory_meta (OstreeRepo *self,
return ret; return ret;
} }
static char * char *
get_object_path (OstreeRepo *self, ostree_repo_get_object_path (OstreeRepo *self,
const char *checksum, const char *checksum,
OstreeObjectType type) OstreeObjectType type)
{ {
@ -756,7 +751,7 @@ prepare_dir_for_checksum_get_object_path (OstreeRepo *self,
char *checksum_dir = NULL; char *checksum_dir = NULL;
char *object_path = NULL; char *object_path = NULL;
object_path = get_object_path (self, checksum, type); object_path = ostree_repo_get_object_path (self, checksum, type);
checksum_dir = g_path_get_dirname (object_path); checksum_dir = g_path_get_dirname (object_path);
if (!ot_util_ensure_directory (checksum_dir, FALSE, error)) if (!ot_util_ensure_directory (checksum_dir, FALSE, error))
@ -1795,7 +1790,7 @@ ostree_repo_load_variant (OstreeRepo *self,
g_return_val_if_fail (error == NULL || *error == NULL, FALSE); g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
path = get_object_path (self, sha256, OSTREE_OBJECT_TYPE_META); path = ostree_repo_get_object_path (self, sha256, OSTREE_OBJECT_TYPE_META);
if (!ostree_parse_metadata_file (path, &ret_type, &ret_variant, error)) if (!ostree_parse_metadata_file (path, &ret_type, &ret_variant, error))
goto out; goto out;
@ -1878,7 +1873,7 @@ checkout_tree (OstreeRepo *self,
char *object_path; char *object_path;
char *dest_path; char *dest_path;
object_path = get_object_path (self, checksum, OSTREE_OBJECT_TYPE_FILE); object_path = ostree_repo_get_object_path (self, checksum, OSTREE_OBJECT_TYPE_FILE);
dest_path = g_build_filename (destination, filename, NULL); dest_path = g_build_filename (destination, filename, NULL);
if (priv->archive) if (priv->archive)

View File

@ -23,7 +23,7 @@
#ifndef _OSTREE_REPO #ifndef _OSTREE_REPO
#define _OSTREE_REPO #define _OSTREE_REPO
#include <glib-object.h> #include "ostree-core.h"
G_BEGIN_DECLS G_BEGIN_DECLS
@ -65,6 +65,10 @@ gboolean ostree_repo_write_config (OstreeRepo *self,
GKeyFile *new_config, GKeyFile *new_config,
GError **error); GError **error);
char * ostree_repo_get_object_path (OstreeRepo *self,
const char *object,
OstreeObjectType type);
gboolean ostree_repo_store_packfile (OstreeRepo *self, gboolean ostree_repo_store_packfile (OstreeRepo *self,
const char *expected_checksum, const char *expected_checksum,
const char *path, const char *path,