diff options
author | Justin Maggard <jmaggard@users.sourceforge.net> | 2009-04-18 06:23:06 +0400 |
---|---|---|
committer | Justin Maggard <jmaggard@users.sourceforge.net> | 2009-04-18 06:23:06 +0400 |
commit | 2874e484607ad96ee5b3e731a990441e00fe7ff1 (patch) | |
tree | 76b91222f0d182d9c7949fd48df6d0137e67d35e /albumart.c | |
parent | 2855817d5909ce53c18ce7c51c959e2a49cbc139 (diff) |
* Fix issues with album art linking if the link target is in a different directory than the previous file.
Diffstat (limited to 'albumart.c')
-rw-r--r-- | albumart.c | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -23,6 +23,7 @@ #include <sys/stat.h> #include <libgen.h> #include <setjmp.h> +#include <errno.h> #include <jpeglib.h> @@ -119,7 +120,15 @@ check_embedded_art(const char * path, const char * image_data, int image_size) } else { - DPRINTF(E_WARN, L_METADATA, "Linking %s to %s failed\n", art_path, last_path); + if( errno == ENOENT ) + { + cache_dir = strdup(art_path); + make_dir(dirname(cache_dir), S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH); + free(cache_dir); + if( link(last_path, art_path) == 0 ) + return(art_path); + } + DPRINTF(E_WARN, L_METADATA, "Linking %s to %s failed [%s]\n", art_path, last_path, strerror(errno)); free(art_path); art_path = NULL; } |