From 08ae030d207aa16c6b59de39b5df8cee6a456ef2 Mon Sep 17 00:00:00 2001
From: Ho Tuan Kiet <tuankiet65@gmail.com>
Date: Tue, 26 Dec 2017 17:30:26 +0000
Subject: Move config directory to B_USER_SETTINGS_DIRECTORY


diff --git a/advance/linux/file.c b/advance/linux/file.c
index 2c90582..8dfbf12 100644
--- a/advance/linux/file.c
+++ b/advance/linux/file.c
@@ -34,6 +34,10 @@
 #include "target.h"
 #include "snstring.h"
 
+#ifdef __HAIKU__
+#include <FindDirectory.h>
+#endif
+
 #if HAVE_SYS_UTSNAME_H
 #include <sys/utsname.h>
 #endif
@@ -89,14 +93,22 @@ adv_error file_init(void)
 	if (home) {
 		snprintf(FL.home_dir_buffer, sizeof(FL.home_dir_buffer), "%s", home);
 	} else {
+#ifdef __HAIKU__
+		char buffer[B_PATH_NAME_LENGTH + B_FILE_NAME_LENGTH];
+		find_directory(B_USER_SETTINGS_DIRECTORY, -1, false, buffer, sizeof(buffer));
+		home = buffer;
+		const char app_folder[] = "advancemame";
+#else
 		/* try $HOME/.advance */
 		home = getenv("HOME");
+		const char app_folder[] = ".advance"
+#endif
 		if (home) {
-			/* add the .advance subdirectory */
+			/* add subdirectory */
 			if (!home[0] || home[strlen(home) - 1] != '/')
-				snprintf(FL.home_dir_buffer, sizeof(FL.home_dir_buffer), "%s/.advance", home);
+				snprintf(FL.home_dir_buffer, sizeof(FL.home_dir_buffer), "%s/%s", home, app_folder);
 			else
-				snprintf(FL.home_dir_buffer, sizeof(FL.home_dir_buffer), "%s.advance", home);
+				snprintf(FL.home_dir_buffer, sizeof(FL.home_dir_buffer), "%s%s", home, app_folder);
 		} else {
 			/* use ROOT */
 			snprintf(FL.home_dir_buffer, sizeof(FL.home_dir_buffer), "%s", FL.data_dir_buffer);
-- 
2.21.0


From fb880364815631b03c50bdc7ab310b3dd2eab130 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Sat, 16 May 2015 18:20:46 +0000
Subject: don't set docdir and mandir, we do already


diff --git a/configure b/configure
index 69a8ac2..bce3fbf 100755
--- a/configure
+++ b/configure
@@ -9740,10 +9740,6 @@ CONF_LIB_JEVENT=$ac_lib_jevent
 
 CONF_LIB_DIRECT=$ac_lib_direct_flag
 
-mandir='${prefix}/man'
-
-docdir='${prefix}/doc'
-
 ac_config_files="$ac_config_files Makefile"
 
 cat >confcache <<\_ACEOF
-- 
2.21.0

