mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-22 03:30:05 +02:00
roadfighter: add patch to use Haiku's settings directory. (#1930)
change settings directory to B_USER_SETTINGS_DIRECTORY Fixes #1294
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
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
|
||||
|
||||
@@ -6,9 +6,10 @@ special type of car)."
|
||||
HOMEPAGE="http://www2.braingames.getput.com/roadf/"
|
||||
COPYRIGHT="2003-2009 Brain Games"
|
||||
LICENSE="GNU GPL v2"
|
||||
REVISION="1"
|
||||
REVISION="2"
|
||||
SOURCE_URI="http://braingames.jorito.net/roadfighter/downloads/roadfighter.src_1.0.1269.tgz"
|
||||
CHECKSUM_SHA256="c6ed315c4b2bf25d598ffa6b5dfd471e7f187ff29b86fd3213054fb6be7c57e7"
|
||||
PATCHES="roadfighter-$portVersion.patchset"
|
||||
|
||||
ARCHITECTURES="x86_gcc2"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user