From: Johannes W. <ja...@mo...> - 2011-06-16 21:26:27
|
Complete relative paths to absolute ones using the directory of the playlists as starting point. Reported-by: Aleksandar_B <ra...@gm...> --- job.c | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff --git a/job.c b/job.c index 36e0d44..187a8e0 100644 --- a/job.c +++ b/job.c @@ -32,6 +32,7 @@ #include "cache.h" #include "player.h" #include "discid.h" +#include "xstrjoin.h" #include <string.h> #include <unistd.h> @@ -206,7 +207,9 @@ static int handle_line(void *data, const char *line) if (is_http_url(line)) { add_url(line); } else { - add_file(line); + char *absolute = path_absolute_cwd(line, data); + add_file(absolute); + free(absolute); } return 0; } @@ -221,10 +224,12 @@ static void add_pl(const char *filename) return; if (buf) { + char *cwd = xstrjoin(filename, "/.."); /* beautiful hack */ reverse = jd->add == play_queue_prepend; - cmus_playlist_for_each(buf, size, reverse, handle_line, NULL); + cmus_playlist_for_each(buf, size, reverse, handle_line, cwd); + free(cwd); munmap(buf, size); } } -- 1.7.6.rc1 |