diff --git a/src/itdb_itunesdb.c b/src/itdb_itunesdb.c index eb29945..1e10937 100644 --- a/src/itdb_itunesdb.c +++ b/src/itdb_itunesdb.c @@ -411,10 +411,23 @@ gchar * itdb_resolve_path (const gchar *root, const gchar * const * components) { gchar *good_path = g_strdup(root); + gchar *absolute_path; + gchar *rel_path; guint32 i; if (!root) return NULL; + + /* stat() is really slow on the iPhone, since the iPhone FS isn't as + * brainded as fat32, attempt a fast path first */ + rel_path = g_build_filenamev ((gchar **)components); + absolute_path = g_build_filename (root, rel_path, NULL); + g_free (rel_path); + if (g_file_test (absolute_path, G_FILE_TEST_EXISTS)) { + return absolute_path; + } + g_free (absolute_path); + /* fast path failed, falling back to slower path */ for(i = 0 ; components[i] ; i++) { GDir *cur_dir; gchar *component_as_filename;