diff --git a/tools/database/database.c b/tools/database/database.c index 1e954d25b7..a518ae8faa 100644 --- a/tools/database/database.c +++ b/tools/database/database.c @@ -3,7 +3,9 @@ #include #include #include +#include #include +#include #include "config.h" #include "tagcache.h" @@ -17,17 +19,28 @@ int main(int argc, char **argv) (void)argc; (void)argv; - errno = 0; - if (mkdir(ROCKBOX_DIR) == -1 && errno != EEXIST) + fprintf(stderr, "Rockbox database tool for '%s'\n\n", TARGET_NAME); + + DIR* rbdir = opendir(ROCKBOX_DIR); + if (!rbdir) { + fprintf(stderr, "Unable to find the '%s' directory!\n", ROCKBOX_DIR); + fprintf(stderr, "This needs to be executed in your DAP's top-level directory!\n\n"); return 1; + } + closedir(rbdir); /* / is actually ., will get translated in io.c * (with the help of sim_root_dir below */ const char *paths[] = { "/", NULL }; tagcache_init(); + + fprintf(stderr, "Scanning files (make take some time)..."); + do_tagcache_build(paths); tagcache_reverse_scan(); + fprintf(stderr, "...done!\n"); + return 0; }