# HG changeset patch # User William Pitcock # Date 1183617611 18000 # Node ID 15f6c9949cde6c08bb5f2c09419f620b541d1dfc # Parent 43a075cb5c813a0c1d81a50b9c5c85bbaf7105a3 Add and use find_path_recursively() which search the FS without using VFS (for GTK). diff -r 43a075cb5c81 -r 15f6c9949cde src/audacious/util.c --- a/src/audacious/util.c Thu Jul 05 01:26:16 2007 -0500 +++ b/src/audacious/util.c Thu Jul 05 01:40:11 2007 -0500 @@ -79,14 +79,14 @@ return TRUE; } - if (g_file_test(path, G_FILE_TEST_IS_REGULAR)) { + if (vfs_file_test(path, G_FILE_TEST_IS_REGULAR)) { if (!strcasecmp(basename, context->to_match)) { context->match = g_strdup(path); context->found = TRUE; return TRUE; } } - else if (g_file_test(path, G_FILE_TEST_IS_DIR)) { + else if (vfs_file_test(path, G_FILE_TEST_IS_DIR)) { dir_foreach(path, find_file_func, context, NULL); if (context->found) return TRUE; @@ -99,19 +99,38 @@ find_file_recursively(const gchar * path, const gchar * filename) { FindFileContext context; - gchar *out; + gchar *out = NULL; context.to_match = filename; context.match = NULL; context.found = FALSE; dir_foreach(path, find_file_func, &context, NULL); - out = g_strconcat("file:", context.match); - g_free(context.match); + + if (context.match) + { + out = g_filename_to_uri(context.match, NULL, NULL); + g_free(context.match); + } return out; } +gchar * +find_path_recursively(const gchar * path, const gchar * filename) +{ + FindFileContext context; + gchar *out = NULL; + + context.to_match = filename; + context.match = NULL; + context.found = FALSE; + + dir_foreach(path, find_file_func, &context, NULL); + + return context.match; +} + typedef enum { ARCHIVE_UNKNOWN = 0, diff -r 43a075cb5c81 -r 15f6c9949cde src/audacious/util.h --- a/src/audacious/util.h Thu Jul 05 01:26:16 2007 -0500 +++ b/src/audacious/util.h Thu Jul 05 01:40:11 2007 -0500 @@ -45,6 +45,7 @@ gchar *find_file_recursively(const gchar * dirname, const gchar * file); +gchar *find_path_recursively(const gchar * dirname, const gchar * file); void del_directory(const gchar * dirname); gboolean dir_foreach(const gchar * path, DirForeachFunc function, gpointer user_data, GError ** error); diff -r 43a075cb5c81 -r 15f6c9949cde src/audacious/widgets/skin.c --- a/src/audacious/widgets/skin.c Thu Jul 05 01:26:16 2007 -0500 +++ b/src/audacious/widgets/skin.c Thu Jul 05 01:40:11 2007 -0500 @@ -277,7 +277,7 @@ gint i; for (i = 0; basenames[i]; i++) - if (!(filename = find_file_recursively(dirname, basenames[i]))) + if (!(filename = find_path_recursively(dirname, basenames[i]))) g_free(filename); else return filename;