LMarbles: Move config and preferences to user settings dir

This commit is contained in:
Markus Himmel
2015-01-14 19:16:33 +00:00
parent 8a09a9e0b5
commit 31a7d8caa9
2 changed files with 84 additions and 5 deletions

View File

@@ -13,7 +13,6 @@ REVISION="2"
LICENSE="GNU GPL v2"
COPYRIGHT="2000 Michael Speck"
ARCHITECTURES="x86_gcc2 ?x86 ?x86_64"
GLOBAL_WRITABLE_FILES="var/lmarbles.prfs keep-old"
PATCHES="lmarbles-1.0.8.patchset"
PROVIDES="
@@ -55,6 +54,11 @@ INSTALL()
make install
mkdir -p $appsDir
mv $binDir/lmarbles $appsDir/LMarbles
rm $localStateDir/lmarbles.prfs
rm -rf $dataDir/applications
rm -rf $dataDir/icons
addAppDeskbarSymlink $appsDir/LMarbles LMarbles
mimeset -f $appsDir/LMarbles
}

View File

@@ -1,8 +1,11 @@
From 6b5f57906db0f0fd8a15fc60da2a791d9ea2bc36 Mon Sep 17 00:00:00 2001
From 9045675625d6ca5bc0c56bbd2be5498ab99776b9 Mon Sep 17 00:00:00 2001
From: Puck Meerburg <puck@puckipedia.nl>
Date: Mon, 5 Jan 2015 17:41:59 +0100
Subject: Apply original lmarbles patch
Subject: [PATCH 1/3] Apply original lmarbles patch
---
configure | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/configure b/configure
index 543fb95..b012313 100755
@@ -30,11 +33,15 @@ index 543fb95..b012313 100755
1.8.3.4
From f837403562b62f6aa17a967597fe61e54499a7bb Mon Sep 17 00:00:00 2001
From a5a1d08c9a5754c3f790088cec87de41a6ac84c5 Mon Sep 17 00:00:00 2001
From: Puck Meerburg <puck@puckipedia.nl>
Date: Mon, 5 Jan 2015 17:54:53 +0100
Subject: Have lmarbles use find_directory for config
Subject: [PATCH 2/3] Have lmarbles use find_directory for config
---
src/cfg.c | 10 ++++++++--
src/profile.c | 11 ++++++++++-
2 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/src/cfg.c b/src/cfg.c
index 2831c1b..4d713f5 100644
@@ -103,3 +110,71 @@ index 218c856..9ebf47b 100644
--
1.8.3.4
From b956be01acbcbf76175ee3a2303f87a99e501320 Mon Sep 17 00:00:00 2001
From: Markus Himmel <markus@himmel-villmar.de>
Date: Wed, 14 Jan 2015 18:38:13 +0000
Subject: [PATCH 3/3] Move lmarbles config to LGames folder
---
src/cfg.c | 6 +++++-
src/profile.c | 6 +++++-
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/cfg.c b/src/cfg.c
index 4d713f5..d9ec8f0 100644
--- a/src/cfg.c
+++ b/src/cfg.c
@@ -27,6 +27,7 @@
#ifdef __HAIKU__
#include <FindDirectory.h>
+#include <fs_info.h>
#endif
#ifdef _WIN32
@@ -45,7 +46,10 @@ void C_StPth()
{
DIR *dir;
#if defined(__HAIKU__)
- find_directory(B_USER_SETTINGS_DIRECTORY, -1, false, c_pth, sizeof(c_pth) - 1);
+ size_t length;
+ find_directory(B_USER_SETTINGS_DIRECTORY, dev_for_path("/boot"), false, c_pth, sizeof(c_pth) - 1);
+ length = strlen(c_pth);
+ snprintf( c_pth+length, sizeof(c_pth)-(1+length), "/LGames" );
#elif defined(_WIN32)
snprintf( c_pth, sizeof(c_pth)-1, "%s/lgames", (getenv( "HOME" )?getenv( "HOME" ):".") );
#else
diff --git a/src/profile.c b/src/profile.c
index 9ebf47b..927f217 100644
--- a/src/profile.c
+++ b/src/profile.c
@@ -24,6 +24,7 @@
#ifdef __HAIKU__
#include <FindDirectory.h>
+#include <fs_info.h>
#endif
// profiles //
@@ -39,13 +40,16 @@ extern Cfg cfg;
/* initialize dyn list and source path */
void Prf_Ini()
{
+ size_t length;
DL_Ini(&prfs);
prfs.flgs = DL_AUTODEL;
prfs.cb = Prf_Del;
#ifdef __HAIKU__
find_directory(B_USER_SETTINGS_DIRECTORY, -1, false, prf_pth,
sizeof(prf_pth) - 1);
- strcat(prf_pth, "/lmarbles.prfs");
+ length = strlen(prf_pth);
+ snprintf(prf_pth + length, sizeof(prf_pth)-(1+length),
+ "/LGames/lmarbles.prfs");
#else
sprintf(prf_pth, "%s/lmarbles.prfs", PRF_DIR);
#endif
--
1.8.3.4