diff options
| author | Thomas Martitz <kugel@rockbox.org> | 2012-07-31 10:33:27 +0200 |
|---|---|---|
| committer | Thomas Martitz <kugel@rockbox.org> | 2012-07-31 10:33:27 +0200 |
| commit | efe73e143ad8997a791b895c9ee21a68b6570429 (patch) | |
| tree | d206dd97632286975a271ea1502f35b56165767f /tools/database/database.c | |
| parent | b358bcfc25272cb03dc95809c0c82688943f0f84 (diff) | |
| download | rockbox-efe73e143ad8997a791b895c9ee21a68b6570429.zip rockbox-efe73e143ad8997a791b895c9ee21a68b6570429.tar.gz rockbox-efe73e143ad8997a791b895c9ee21a68b6570429.tar.bz2 rockbox-efe73e143ad8997a791b895c9ee21a68b6570429.tar.xz | |
Fix database tool.
It was also broken functionally, probably since a while.So restore the
functionality. Run it on the dap, the tcd files will be placed into .rockbox folder.
Change-Id: Id7a6ce4389dfaf99799258902be80d630af0601c
Diffstat (limited to 'tools/database/database.c')
| -rw-r--r-- | tools/database/database.c | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/tools/database/database.c b/tools/database/database.c index 0f9304e..30f1c39 100644 --- a/tools/database/database.c +++ b/tools/database/database.c @@ -2,26 +2,37 @@ #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(); - tagcache_build("."); + do_tagcache_build(paths); tagcache_reverse_scan(); return 0; } -/* stub to avoid including all of apps/misc.c */ -bool file_exists(const char *file) -{ - struct stat s; - if (!stat(file, &s)) - return true; - return false; -} +/* needed for io.c */ +const char *sim_root_dir = "."; /* stubs to avoid including thread-sdl.c */ #include "kernel.h" |