1
0
Fork 0
forked from len0rd/rockbox
foxbox/tools/database/database.c
Solomon Peachy e803daae0a dbtool: Fix it up so that it runs from the CURRENT working directory
This makes it far more useful, as before it insisted on scanning from
the root directory and putting the generated db files in /.rockbox

Change-Id: I0d0e3c6c6c7ee1fc5473185482fbfb9a2a2be29f
2023-05-25 15:43:15 -04:00

63 lines
1.1 KiB
C

/* A _very_ skeleton file to demonstrate building tagcache db on host. */
#include <stdbool.h>
#include <stdio.h>
#include <errno.h>
#include <sys/stat.h>
#include "config.h"
#include "tagcache.h"
#include "dir.h"
/* This is meant to be run on the root of the dap. it'll put the db files into
* a .rockbox subdir */
int main(int argc, char **argv)
{
(void)argc;
(void)argv;
errno = 0;
if (mkdir(ROCKBOX_DIR) == -1 && errno != EEXIST)
return 1;
/* / is actually ., will get translated in io.c
* (with the help of sim_root_dir below */
const char *paths[] = { "./", NULL };
tagcache_init();
do_tagcache_build(paths);
tagcache_reverse_scan();
return 0;
}
/* needed for io.c */
const char *sim_root_dir = ".";
/* stubs to avoid including thread-sdl.c */
#include "kernel.h"
void mutex_init(struct mutex *m)
{
(void)m;
}
void mutex_lock(struct mutex *m)
{
(void)m;
}
void mutex_unlock(struct mutex *m)
{
(void)m;
}
void sim_thread_lock(void *me)
{
(void)me;
}
void * sim_thread_unlock(void)
{
return (void*)1;
}