]> git.draconx.ca Git - upkg.git/blobdiff - src/uobject/vfs.c
package: Make the VFS directly open the package file.
[upkg.git] / src / uobject / vfs.c
index 5465144d2826b561854e9c00e4b0bb9a001908a2..fcbb3e51c273ac407078dea406a3aa25c9b909f1 100644 (file)
@@ -23,6 +23,7 @@
 #include <strings.h>
 
 #include <uobject/vfs.h>
+#include <upkg.h>
 #include <ltdl.h>
 
 #include "avl.h"
@@ -123,17 +124,17 @@ void u_pkg_vfs_del_local(const char *name)
        free(item);
 }
 
-const char *u_pkg_vfs_lookup(const char *name)
+struct upkg *u_pkg_vfs_open_by_name(const char *name)
 {
        struct local_pkg spec = { .name = (char *)name }, *item;
 
-       if (!local_tree)
+       if (!initialized)
                return NULL;
 
        item = avl_find(local_tree, &spec);
-       if (!item)
-               return NULL;
-       return item->file;
+       if (item)
+               return upkg_fopen(item->file);
+       return NULL;
 }
 
 int u_pkg_vfs_init(void)