]> git.draconx.ca Git - upkg.git/blob - src/uobject/vfs.h
package: Get rid of separate mechanisms for opening packages.
[upkg.git] / src / uobject / vfs.h
1 /*
2  *  Functions for handling UObject package search paths.
3  *  Copyright (C) 2009 Nick Bowler
4  *
5  *  This program is free software: you can redistribute it and/or modify
6  *  it under the terms of the GNU General Public License as published by
7  *  the Free Software Foundation, either version 3 of the License, or
8  *  (at your option) any later version.
9  *
10  *  This program is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  *  GNU General Public License for more details.
14  *
15  *  You should have received a copy of the GNU General Public License
16  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
17  */
18 #ifndef U_OBJECT_VFS_H_
19 #define U_OBJECT_VFS_H_
20
21 /*
22  * Insert a local package to the VFS.  A "local package" is an explicit
23  * association of a name to a file, and thus can be located outside the normal
24  * search path.  Local packages are searched before any other location.
25  *
26  * Returns a pointer to an internal copy of name on success, or NULL on
27  * failure.  The returned name must not be modified or freed.  If name is
28  * NULL, it is determined automatically from the filename.
29  */
30 const char *u_pkg_vfs_add_local(const char *name, const char *file);
31
32 /*
33  * Remove a local package from the VFS by name.
34  */
35 void u_pkg_vfs_del_local(const char *name);
36
37 /*
38  * Find a package by name in the VFS.  Names are case-insensitive.
39  */
40 const char *u_pkg_vfs_lookup(const char *name);
41
42 /*
43  * Initialize the UObject VFS system.  Returns 0 on success, -1 otherwise.
44  * The VFS system can be safely initialized multiple times.
45  */
46 int u_pkg_vfs_init(void);
47
48 /*
49  * Shutdown the UObject VFS system.
50  * The VFS system is only shut down when this function has been called as
51  * many times as u_pkg_vfs_init.
52  */
53 void u_pkg_vfs_exit(void);
54
55 #endif