From 38c2f2d203dbae75d1c7a54933e8607a08cdfc60 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Fri, 10 Oct 2014 15:38:14 +0000
Subject: On Haiku use the user settings directory.


diff --git a/utils/cmdline.c b/utils/cmdline.c
index 3e5ca8d..ada74fa 100644
--- a/utils/cmdline.c
+++ b/utils/cmdline.c
@@ -37,6 +37,10 @@
 
 #include <flickcurl_cmd.h>
 
+#ifdef __HAIKU__
+#include <FindDirectory.h>
+#include <StorageDefs.h>
+#endif
 
 /* private to this module */
 #define CONFIG_FILENAME_LEN 15
@@ -50,15 +54,26 @@ char* flickcurl_cmdline_config_path = NULL;
 int
 flickcurl_cmdline_init(void)
 {
+#ifdef __HAIKU__
+  char settingsPath[B_PATH_NAME_LENGTH];
+#endif
   size_t config_len = CONFIG_FILENAME_LEN;
   const char* home;
 
   if(flickcurl_cmdline_config_path)
     return 0;
 
+#ifndef __HAIKU__
   home = getenv("HOME");
   if(home)
     config_len += strlen(home) + 1;
+#else
+  if (find_directory(B_USER_SETTINGS_DIRECTORY, -1, true, settingsPath,
+  	sizeof(settingsPath)) == B_OK) {
+    home = settingsPath;
+  } else
+    home = NULL;
+#endif
 
   flickcurl_cmdline_config_path = malloc(config_len + 1);
   if(!flickcurl_cmdline_config_path)
-- 
1.8.3.4

