Mercurial > audlegacy
changeset 1666:77baac5f7439 trunk
[svn] - make fileinfo_recursive_get_image() breadth first search.
author | yaz |
---|---|
date | Sun, 10 Sep 2006 23:39:54 -0700 |
parents | de0a0927a5c2 |
children | 991fa4c7271d |
files | ChangeLog audacious/ui_fileinfo.c |
diffstat | 2 files changed, 45 insertions(+), 32 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Sun Sep 10 15:36:17 2006 -0700 +++ b/ChangeLog Sun Sep 10 23:39:54 2006 -0700 @@ -1,3 +1,12 @@ +2006-09-10 22:36:17 +0000 Tony Vroon <chainsaw@gentoo.org> + revision [2267] + Revert broken commit r2209 and fseek -> vfs_fseek, missed in commit r2265. + + Changes: Modified: + +1 -1 trunk/Plugins/Input/wma/libffwma/mem.c + +1 -1 trunk/Plugins/Output/disk_writer/disk_writer.c + + 2006-09-10 21:28:45 +0000 Tony Vroon <chainsaw@gentoo.org> revision [2265] Have output plugins use the VFS layer too.
--- a/audacious/ui_fileinfo.c Sun Sep 10 15:36:17 2006 -0700 +++ b/audacious/ui_fileinfo.c Sun Sep 10 23:39:54 2006 -0700 @@ -412,46 +412,50 @@ d = g_dir_open(path, 0, NULL); - if (d) - { + if (d) { const gchar *f = g_dir_read_name(d); - while (f) - { + /* first pass only searches for files. */ + while(f) { gchar *newpath = g_strdup_printf("%s/%s", path, f); - if (is_front_cover_image(f)) - { - /* We found a suitable file in the current - * directory, use that. The string will be - * freed by the caller */ - g_dir_close(d); - return newpath; - } - else - { - f = g_dir_read_name(d); - if (cfg.recurse_for_cover) - { - /* File/directory wasn't suitable, try and recurse into it. - * This should either return a filename for a image file, - * or NULL if there was no suitable file, or 'f' wasn't a dir. - */ - gchar *tmp = fileinfo_recursive_get_image(newpath, depth+1); - - if(tmp) - { - g_free(newpath); - g_dir_close(d); - return tmp; - } + if(!g_file_test(newpath, G_FILE_TEST_IS_DIR)) { + if(is_front_cover_image(f)) { + g_dir_close(d); + return newpath; } } + g_free(newpath); + f = g_dir_read_name(d); } - + + /* checks whether recursive or not. */ + if(!cfg.recurse_for_cover) { + g_dir_close(d); + return NULL; + } + + /* second pass descends directory recursively. */ + g_dir_rewind(d); + f = g_dir_read_name(d); + + while(f) { + gchar *newpath = g_strdup_printf("%s/%s", path, f); + + if(g_file_test(newpath, G_FILE_TEST_IS_DIR)) { + gchar *tmp = fileinfo_recursive_get_image(newpath, depth+1); + if(tmp) { + g_free(newpath); + g_dir_close(d); + return tmp; + } + } + g_free(newpath); + f = g_dir_read_name(d); + } + g_dir_close(d); - } - + } return NULL; }