summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2024-02-20 14:19:27 -0500
committerSolomon Peachy <pizza@shaftnet.org>2024-02-20 14:38:49 -0500
commit386b6d6bae020b9aafe5f572173a3bfb5d319f6a (patch)
treedc705ec57ad068ff8c86249ccb8f257ad5c92a7c
parente122243bb0c80e582c15360d4c334345aefdc9c9 (diff)
downloadrockbox-386b6d6bae.tar.gz
rockbox-386b6d6bae.zip
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
-rw-r--r--tools/database/database.c17
1 files 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 <stdbool.h>
#include <stdio.h>
#include <errno.h>
+#include <dirent.h>
#include <sys/stat.h>
+#include <sys/types.h>
#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;
}