From 738970bd4ae646170a3431029cc1261e569919e4 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@gmail.com>
Date: Sat, 30 Aug 2014 19:13:37 +0200
Subject: Move cddb cache to B_USER_CACHE_DIRECTORY.


diff --git a/lib/cddb_conn.c b/lib/cddb_conn.c
index 5ca4f7c..aca8de8 100644
--- a/lib/cddb_conn.c
+++ b/lib/cddb_conn.c
@@ -45,6 +45,9 @@
 #include <unistd.h>
 #endif
 
+#ifdef __HAIKU__
+#include <FindDirectory.h>
+#endif
 
 /* --- prototypes --- */
 
@@ -99,9 +102,18 @@ cddb_conn_t *cddb_new(void)
 
         c->use_cache = CACHE_ON;
         /* construct cache dir '$HOME/[DEFAULT_CACHE]' */
+#ifdef __HAIKU__
+		{
+			char buf[512];
+			find_directory(B_USER_CACHE_DIRECTORY, 0, false, buf, 512);
+        	c->cache_dir = (char*)malloc(strlen(buf) + 1 + sizeof(DEFAULT_CACHE) + 1);
+        	sprintf(c->cache_dir, "%s/%s", buf, DEFAULT_CACHE);
+		}
+#else
         s = getenv("HOME");
         c->cache_dir = (char*)malloc(strlen(s) + 1 + sizeof(DEFAULT_CACHE) + 1);
         sprintf(c->cache_dir, "%s/%s", s, DEFAULT_CACHE);
+#endif
         c->cache_read = FALSE;
 
         /* use anonymous@localhost */
-- 
1.8.3.4

