xbps_init() now sets rootdir, cachedir and flags.

That means that the following functions were removed:
	- xbps_set_{cachedir,flags,rootdir}.
	- xbps_get_{cachedir,flags,rootdir}.

With this change fixed an obvious typo that made -c argument to not work,
and now the cache directory is an absolute path not relative to rootdir.
This commit is contained in:
Juan RP
2011-02-21 17:42:47 +01:00
parent 8d5a1ad0a3
commit 870ad18d58
30 changed files with 195 additions and 227 deletions

View File

@ -37,11 +37,11 @@
* @brief Initialization and finalization routines
* @defgroup initend Initialization and finalization functions
*
* Use these functions to initialize some parameters before starting
* Use these functions to initialize some parameters before start
* using libxbps and finalize usage to release resources at the end.
*/
static bool debug;
static const struct xbps_handle *xhp;
static struct xbps_handle *xhp;
void
xbps_init(struct xbps_handle *xh)
@ -52,6 +52,13 @@ xbps_init(struct xbps_handle *xh)
debug = xhp->with_debug;
xbps_fetch_set_cache_connection(XBPS_FETCH_CACHECONN,
XBPS_FETCH_CACHECONN_HOST);
/* If rootdir not set, defaults to '/' */
if (xhp->rootdir == NULL)
xhp->rootdir = "/";
/* If cachedir not set, defaults to XBPS_CACHE_PATH */
if (xhp->cachedir == NULL)
xhp->cachedir = XBPS_CACHE_PATH;
}
void
@ -63,9 +70,10 @@ xbps_end(void)
xhp = NULL;
}
const struct xbps_handle HIDDEN *
const struct xbps_handle *
xbps_handle_get(void)
{
assert(xhp != NULL);
return xhp;
}