From 386b6d6bae020b9aafe5f572173a3bfb5d319f6a Mon Sep 17 00:00:00 2001 From: Solomon Peachy Date: Tue, 20 Feb 2024 14:19:27 -0500 Subject: dbtool: Make the dbtool marginally more user friendly. * Inform you what target it is compiled for * Complain if it doesn't find the '.rockbox' directory (Instead of creating the directory if it's not found!) * Report basic (starting/finished) progress Change-Id: Ic336dd686ce4419172a1c287995966d0f00e6107 --- tools/database/database.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) 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; } -- cgit v1.2.3