forked from len0rd/rockbox
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
This commit is contained in:
parent
e122243bb0
commit
386b6d6bae
1 changed files with 15 additions and 2 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue