summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2007-07-31 12:57:22 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2007-07-31 12:57:22 +0000
commitc687f8c687a203e578611f66108f09e641f8092b (patch)
treea1aa4ac7a155e4cbbae4b1441c352b6d717f0d7d /apps
parent60b01fa0f7e5126406d1fd2f37cce82d2faffdc4 (diff)
FS#2735 - stats plugin now shows the number of files in the biggest directory
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14101 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/plugins/stats.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/apps/plugins/stats.c b/apps/plugins/stats.c
index dca5e89753..a33331a429 100644
--- a/apps/plugins/stats.c
+++ b/apps/plugins/stats.c
@@ -21,7 +21,7 @@
PLUGIN_HEADER
static struct plugin_api* rb;
-static int files, dirs, musicfiles;
+static int files, dirs, musicfiles, largestdir;
static int lasttick;
static bool abort;
@@ -76,7 +76,7 @@ void prn(const char *str, int y)
void update_screen(void)
{
- char buf[15];
+ char buf[32];
rb->lcd_clear_display();
#ifdef HAVE_REMOTE_LCD
@@ -90,6 +90,8 @@ void update_screen(void)
prn(buf,1);
rb->snprintf(buf, sizeof(buf), "Dirs: %d", dirs);
prn(buf,2);
+ rb->snprintf(buf, sizeof(buf), "Max files in Dir: %d", largestdir);
+ prn(buf,3);
#else
rb->snprintf(buf, sizeof(buf), "Files:%5d", files);
prn(buf,0);
@@ -109,6 +111,7 @@ void traversedir(char* location, char* name)
struct dirent *entry;
DIR* dir;
char fullpath[MAX_PATH];
+ int files_in_dir = 0;
rb->snprintf(fullpath, sizeof(fullpath), "%s/%s", location, name);
dir = rb->opendir(fullpath);
@@ -126,7 +129,7 @@ void traversedir(char* location, char* name)
}
else {
char *ptr = rb->strrchr(entry->d_name,'.');
- files++;
+ files++; files_in_dir++;
/* Might want to only count .mp3, .ogg etc. */
if(ptr){
unsigned i;
@@ -157,6 +160,8 @@ void traversedir(char* location, char* name)
}
rb->closedir(dir);
}
+ if (largestdir < files_in_dir)
+ largestdir = files_in_dir;
}
enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
@@ -169,6 +174,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
files = 0;
dirs = 0;
musicfiles = 0;
+ largestdir = 0;
abort = false;
rb->splash(HZ, "Counting...");