From 958cf5cbff54fa158d970a6a5848dcd14b970cda Mon Sep 17 00:00:00 2001 From: jcsjcs Date: Sun, 4 Dec 2005 05:27:13 +0000 Subject: * src/db-artwork-writer/parser.c: Create ArtworkDB when it does not exist. git-svn-id: https://gtkpod.svn.sf.net/svnroot/gtkpod/libgpod/trunk@1183 f01d2545-417e-4e96-918e-98f8d0dbbcb6 --- src/db-artwork-parser.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'src/db-artwork-parser.c') diff --git a/src/db-artwork-parser.c b/src/db-artwork-parser.c index 6796bbe..2709e42 100644 --- a/src/db-artwork-parser.c +++ b/src/db-artwork-parser.c @@ -438,8 +438,24 @@ parse_mhfd (DBParseContext *ctx, Itdb_iTunesDB *db, GError **error) G_GNUC_INTERNAL char * ipod_db_get_artwork_db_path (const char *mount_point) { + gchar *filename; const char *paths[] = {"iPod_Control", "Artwork", "ArtworkDB", NULL}; - return itdb_resolve_path (mount_point, paths); + filename = itdb_resolve_path (mount_point, paths); + + /* itdb_resolve_path() only returns existing paths */ + if (!filename) + { + gchar *path; + paths[2] = NULL; + path = itdb_resolve_path (mount_point, (const char **)paths); + if (path) + { + filename = g_build_filename (path, "ArtworkDB", NULL); + } + g_free (path); + } + + return filename; } @@ -492,7 +508,11 @@ ipod_parse_artwork_db (Itdb_iTunesDB *db) filename = ipod_db_get_artwork_db_path (db->mountpoint); if (filename == NULL) { goto error; - } + } + if (!g_file_test (filename, G_FILE_TEST_EXISTS)) + { + goto error; + } ctx = db_parse_context_new_from_file (filename); g_free (filename); if (ctx == NULL) { -- cgit