# HG changeset patch # User Matti Hamalainen # Date 1212017719 -10800 # Node ID 3f931f9337507dedeca86c69b14b42ecff4ebec1 # Parent 21c03670003370101b1446b567d9884b5842e88f A tentative fix for adding XSPF playlists with relative file/pathnames. NOTICE!! Please test that this does not break anything else! diff -r 21c036700033 -r 3f931f933750 src/xspf/xspf.c --- a/src/xspf/xspf.c Wed May 28 22:21:54 2008 +0300 +++ b/src/xspf/xspf.c Thu May 29 02:35:19 2008 +0300 @@ -134,8 +134,10 @@ if (!xmlStrcmp(nptr->name, (xmlChar *)"location")) { /* Location is a special case */ gchar *str = (gchar *)xmlNodeGetContent(nptr); - - location = g_strdup_printf("%s%s", base ? base : "", str); + if (!strstr(str, "://") && base) + location = g_strdup_printf("%s/%s", base, str); + else + location = g_strdup(str); xmlFree(str); } else { /* Rest of the nodes are handled here */ @@ -260,7 +262,7 @@ base = (gchar *)xmlNodeGetBase(doc, nptr); - AUDDBG("base = %s\n", base); + AUDDBG("base #1 = %s\n", base); // if filename is specified as a base, ignore it. tmp = xmlURIUnescapeString(base, -1, NULL); @@ -272,7 +274,12 @@ g_free(tmp); } - AUDDBG("base = %s\n", base); + AUDDBG("base #2 = %s\n", base); + + if (!base) + base = g_path_get_dirname(filename); + + AUDDBG("base #3 = %s\n", base); for (nptr2 = nptr->children; nptr2 != NULL; nptr2 = nptr2->next) {