mirror of
https://github.com/yann64/haikuports.git
synced 2026-05-04 14:08:51 +02:00
64 lines
1.7 KiB
Plaintext
64 lines
1.7 KiB
Plaintext
From 47fa7741e38ba15e4b9868945b2b598fda6eb970 Mon Sep 17 00:00:00 2001
|
|
From: Owen <owenca@users.noreply.github.com>
|
|
Date: Thu, 21 Dec 2017 03:10:58 +0000
|
|
Subject: roadfighter: change settings directory to B_USER_SETTINGS_DIRECTORY
|
|
|
|
Fixes #1294
|
|
|
|
diff --git a/build/linux/Makefile b/build/linux/Makefile
|
|
index 064c63d..b62faf3 100644
|
|
--- a/build/linux/Makefile
|
|
+++ b/build/linux/Makefile
|
|
@@ -39,6 +39,9 @@ OBJS = \
|
|
CC = g++
|
|
CFLAGS = -g3 -O3 `sdl-config --cflags` -I/usr/X11R6/include
|
|
LDFLAGS = `sdl-config --libs` -L/usr/X11R6/lib/ -lSDL_image -lSDL_mixer -lSDL_sound -lSDL_ttf
|
|
+#ifdef __HAIKU__
|
|
+LDFLAGS += -lbe
|
|
+#endif
|
|
RM = rm -f
|
|
CP = cp -r
|
|
MD = mkdir -p
|
|
diff --git a/src/filehandling.cpp b/src/filehandling.cpp
|
|
index 5f5bfd8..284b1b9 100644
|
|
--- a/src/filehandling.cpp
|
|
+++ b/src/filehandling.cpp
|
|
@@ -1,5 +1,10 @@
|
|
#include "filehandling.h"
|
|
|
|
+#ifdef __HAIKU__
|
|
+#include <FindDirectory.h>
|
|
+#include <Path.h>
|
|
+#endif
|
|
+
|
|
#ifndef _WIN32
|
|
// make (sub)directories including multiple subdirs
|
|
int mkdirp(const char *fqfn, mode_t mode) {
|
|
@@ -42,13 +47,23 @@ FILE *f1open(const char *f, const char *m, const enum filetype t) {
|
|
break;
|
|
|
|
case USERDATA:
|
|
+#ifdef __HAIKU__
|
|
+ {
|
|
+ BPath path;
|
|
+ find_directory(B_USER_SETTINGS_DIRECTORY, &path);
|
|
+ snprintf(fname, STRLEN-1, "%s/%s/%s", path.Path(), GAMENAME, f);
|
|
+#else
|
|
// userdata is put in $HOME/.GAMENAME/
|
|
snprintf(fname, STRLEN-1, "%s/.%s/%s", getenv("HOME"), GAMENAME, f);
|
|
+#endif
|
|
// create subdirs if they don't exist
|
|
mkdirp(fname, S_IRWXU | S_IRGRP|S_IXGRP | S_IROTH|S_IXOTH);
|
|
// open file
|
|
return(fopen(fname, m));
|
|
break;
|
|
+#ifdef __HAIKU__
|
|
+ }
|
|
+#endif
|
|
}
|
|
#endif
|
|
|
|
--
|
|
2.7.0
|
|
|