diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2024-02-20 14:19:27 -0500 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2024-02-20 14:38:49 -0500 |
commit | 386b6d6bae020b9aafe5f572173a3bfb5d319f6a (patch) | |
tree | dc705ec57ad068ff8c86249ccb8f257ad5c92a7c | |
parent | e122243bb0c80e582c15360d4c334345aefdc9c9 (diff) | |
download | rockbox-386b6d6bae020b9aafe5f572173a3bfb5d319f6a.tar.gz rockbox-386b6d6bae020b9aafe5f572173a3bfb5d319f6a.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.c | 17 |
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 @@ | |||
3 | #include <stdbool.h> | 3 | #include <stdbool.h> |
4 | #include <stdio.h> | 4 | #include <stdio.h> |
5 | #include <errno.h> | 5 | #include <errno.h> |
6 | #include <dirent.h> | ||
6 | #include <sys/stat.h> | 7 | #include <sys/stat.h> |
8 | #include <sys/types.h> | ||
7 | 9 | ||
8 | #include "config.h" | 10 | #include "config.h" |
9 | #include "tagcache.h" | 11 | #include "tagcache.h" |
@@ -17,17 +19,28 @@ int main(int argc, char **argv) | |||
17 | (void)argc; | 19 | (void)argc; |
18 | (void)argv; | 20 | (void)argv; |
19 | 21 | ||
20 | errno = 0; | 22 | fprintf(stderr, "Rockbox database tool for '%s'\n\n", TARGET_NAME); |
21 | if (mkdir(ROCKBOX_DIR) == -1 && errno != EEXIST) | 23 | |
24 | DIR* rbdir = opendir(ROCKBOX_DIR); | ||
25 | if (!rbdir) { | ||
26 | fprintf(stderr, "Unable to find the '%s' directory!\n", ROCKBOX_DIR); | ||
27 | fprintf(stderr, "This needs to be executed in your DAP's top-level directory!\n\n"); | ||
22 | return 1; | 28 | return 1; |
29 | } | ||
30 | closedir(rbdir); | ||
23 | 31 | ||
24 | /* / is actually ., will get translated in io.c | 32 | /* / is actually ., will get translated in io.c |
25 | * (with the help of sim_root_dir below */ | 33 | * (with the help of sim_root_dir below */ |
26 | const char *paths[] = { "/", NULL }; | 34 | const char *paths[] = { "/", NULL }; |
27 | tagcache_init(); | 35 | tagcache_init(); |
36 | |||
37 | fprintf(stderr, "Scanning files (make take some time)..."); | ||
38 | |||
28 | do_tagcache_build(paths); | 39 | do_tagcache_build(paths); |
29 | tagcache_reverse_scan(); | 40 | tagcache_reverse_scan(); |
30 | 41 | ||
42 | fprintf(stderr, "...done!\n"); | ||
43 | |||
31 | return 0; | 44 | return 0; |
32 | } | 45 | } |
33 | 46 | ||