Mercurial > audlegacy
comparison src/audacious/util.c @ 4627:a7392e85d4c6
Cosmetics.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 11 Jun 2008 13:08:58 +0300 |
parents | 332d2992e04c |
children |
comparison
equal
deleted
inserted
replaced
4622:a615322374c8 | 4627:a7392e85d4c6 |
---|---|
993 | 993 |
994 // make full path uri here | 994 // make full path uri here |
995 // case 1: filename is raw full path or uri | 995 // case 1: filename is raw full path or uri |
996 if (filename[0] == '/' || strstr(filename, "://")) { | 996 if (filename[0] == '/' || strstr(filename, "://")) { |
997 uri = g_filename_to_uri(filename, NULL, NULL); | 997 uri = g_filename_to_uri(filename, NULL, NULL); |
998 if(!uri) { | 998 if(!uri) |
999 uri = g_strdup(filename); | 999 uri = g_strdup(filename); |
1000 } | |
1001 g_free(filename); | 1000 g_free(filename); |
1002 } | 1001 } |
1003 // case 2: filename is not raw full path nor uri, playlist path is full path | 1002 // case 2: filename is not raw full path nor uri, playlist path is full path |
1004 // make full path by replacing last part of playlist path with filename. (using g_build_filename) | 1003 // make full path by replacing last part of playlist path with filename. (using g_build_filename) |
1005 else if (playlist_name[0] == '/' || strstr(playlist_name, "://")) { | 1004 else if (playlist_name[0] == '/' || strstr(playlist_name, "://")) { |
1006 path = g_filename_from_uri(playlist_name, NULL, NULL); | 1005 path = g_filename_from_uri(playlist_name, NULL, NULL); |
1007 if (!path) { | 1006 if (!path) |
1008 path = g_strdup(playlist_name); | 1007 path = g_strdup(playlist_name); |
1009 } | |
1010 tmp = strrchr(path, '/'); *tmp = '\0'; | 1008 tmp = strrchr(path, '/'); *tmp = '\0'; |
1011 tmp = g_build_filename(path, filename, NULL); | 1009 tmp = g_build_filename(path, filename, NULL); |
1012 g_free(path); g_free(filename); | 1010 g_free(path); g_free(filename); |
1013 uri = g_filename_to_uri(tmp, NULL, NULL); | 1011 uri = g_filename_to_uri(tmp, NULL, NULL); |
1014 g_free(tmp); | 1012 g_free(tmp); |
1015 } | 1013 } |
1016 // case 3: filename is not raw full path nor uri, playlist path is not full path | 1014 // case 3: filename is not raw full path nor uri, playlist path is not full path |
1017 // just abort. | 1015 // just abort. |
1018 else { | 1016 else { |
1019 g_free(filename); | 1017 g_free(filename); |
1020 return NULL; | 1018 uri = NULL; |
1021 } | 1019 } |
1022 | 1020 |
1023 AUDDBG("uri=%s\n", uri); | 1021 AUDDBG("uri=%s\n", uri); |
1024 return uri; | 1022 return uri; |
1025 } | 1023 } |