52 lines
1.4 KiB
Plaintext
52 lines
1.4 KiB
Plaintext
From b7ed76706d82e32bfb3f748dadffafa622eb3968 Mon Sep 17 00:00:00 2001
|
|
From: begasus <begasus@gmail.com>
|
|
Date: Thu, 28 Jul 2016 11:46:18 +0200
|
|
Subject: applying patch lgeneral 1.3.1
|
|
|
|
|
|
diff --git a/src/config.c b/src/config.c
|
|
index 3b1dfef..fb495c0 100644
|
|
--- a/src/config.c
|
|
+++ b/src/config.c
|
|
@@ -22,6 +22,13 @@
|
|
#include <sys/types.h>
|
|
#include <sys/stat.h>
|
|
#include <unistd.h>
|
|
+
|
|
+#ifdef __HAIKU__
|
|
+#include <SupportDefs.h>
|
|
+#include <FindDirectory.h>
|
|
+#include <fs_info.h>
|
|
+#endif
|
|
+
|
|
#include "lg-sdl.h"
|
|
#include "config.h"
|
|
#include "parser.h"
|
|
@@ -32,13 +39,21 @@ Config config;
|
|
/* check if config directory exists; if not create it and set config_dir */
|
|
void check_config_dir_name()
|
|
{
|
|
+ size_t length;
|
|
struct stat info;
|
|
#ifndef INSTALLDIR
|
|
/* if no installation store config to current directory not home */
|
|
sprintf( config.dir_name, "." );
|
|
-#else
|
|
+#elif __HAIKU__
|
|
+ find_directory(B_USER_SETTINGS_DIRECTORY, dev_for_path("/boot"), false,
|
|
+ config.dir_name, sizeof(config.dir_name) - 1);
|
|
+ length = strlen(config.dir_name);
|
|
+ snprintf(config.dir_name + length, sizeof(config.dir_name) - (1 + length),
|
|
+ "/LGames");
|
|
+ fprintf( stderr, "HAIKU: Config path is %s\n", config.dir_name);
|
|
+#else
|
|
sprintf( config.dir_name, "%s/.lgames", getenv( "HOME" ) );
|
|
-#endif
|
|
+#endif
|
|
if ( stat( config.dir_name, &info ) != 0 ) {
|
|
int res;
|
|
|
|
--
|
|
2.7.0
|
|
|