From 4bb650564a24ec9d6915684c3370caa293bdd002 Mon Sep 17 00:00:00 2001
From: Markus Himmel <markus@himmel-villmar.de>
Date: Mon, 12 Jan 2015 18:11:27 +0000
Subject: [PATCH 1/3] applying patch lbreakout2-2.6.4.patch

---
 LBreakout2.rdef | 33 +++++++++++++++++++++++++++++++++
 client/chart.c  |  6 ++++++
 configure       |  4 ++--
 3 files changed, 41 insertions(+), 2 deletions(-)
 create mode 100644 LBreakout2.rdef

diff --git a/LBreakout2.rdef b/LBreakout2.rdef
new file mode 100644
index 0000000..6b165ae
--- /dev/null
+++ b/LBreakout2.rdef
@@ -0,0 +1,33 @@
+resource app_signature "application/x-vnd.lgames.lbreakout2";
+
+resource app_flags B_SINGLE_LAUNCH;
+
+resource app_version {
+	major  = 2,
+	middle = 6,
+	minor  = 4,
+
+	/* 0 = development	1 = alpha			2 = beta
+	   3 = gamma		4 = golden master	5 = final */
+	variety = 5,
+
+	internal = 0,
+
+	short_info = "LBreakout2 arcade game.",
+	long_info  = "LBreakout2 is a fun breakout-style arcade game."
+};
+
+resource vector_icon {
+	$"6E63696605020106023D5738B7D6E13769AC3CF83249ADC94642AAFFA5040400"
+	$"FF9E9E02000205B6B6DB3925EEBD5FCABAE8BF4A54944AC9EB00846C1BFF34B6"
+	$"9627FF77DBCD5CF983C9C088FFFE6A5716FF020106023B7084B697593638963A"
+	$"F2BB4202AB49ECC600AAD2A5F440503F050001010000850502044C24C62E24C2"
+	$"E124442C44B62144B96E4C34C2E134C62E34542C54B96E54B6210604AF303937"
+	$"3C2B3A2948243E2D4A48584E450204B6C93AB8A73AB4EA3AB365C0BFB365BEE0"
+	$"B365C29DB6C94BB4EA4BB8A74B32C0BF32C29D32BEE006033E402E5037423A50"
+	$"374438493B3F330606BE0F3039233D27352242294822452948445654574E5C5B"
+	$"504E4555474642090A0401042028220A0301041001178500040A020102024000"
+	$"000000000000003FC3C3400000BDC3C30A010101000A02010202404DAB000000"
+	$"000000404DAB4A26D645D13D0A000100000A0301001001178100040A03010300"
+	$"0A030103023EC27B0000000000003EC27B46388E46B10D"
+};
diff --git a/client/chart.c b/client/chart.c
index 68e9f44..8fbd8c6 100644
--- a/client/chart.c
+++ b/client/chart.c
@@ -213,6 +213,7 @@ void chart_load()
     }
     printf( _("Saving highscore chart in: %s\n"), chart_path );
     /* compute size and position stuff of highscore */
+    {
     char *cheader = _("Name      Level Score");
     chart_pos.w = stk_font_string_width( ccfont, cheader );
     chart_pos.h = ccfont->height +  chart_gap + /* title + gap */
@@ -220,6 +221,7 @@ void chart_load()
               chart_gap + /*gap between caption and entries */
               ccfont->height; /* caption size */
     chart_level_offset = stk_font_string_width( ccfont, _("name.-----") ) + stk_font_string_width( ccfont, _("Level") ) / 2; /* level offset centered */
+    }
 }
 /*
 ====================================================================
@@ -344,6 +346,7 @@ void chart_show( Set_Chart *chart, int x, int y, int w, int h )
         chart->name );
 	/* caption */
     ccfont->align = STK_FONT_ALIGN_LEFT | STK_FONT_ALIGN_TOP;
+    {
     char *cheader = _("Name      Level Score");
     stk_font_write( ccfont, stk_display, 
         chart_pos.x, chart_pos.y + ccfont->height + chart_gap, -1, 
@@ -370,6 +373,7 @@ void chart_show( Set_Chart *chart, int x, int y, int w, int h )
             chart_pos.x + chart_pos.w, entry_offset, -1, number_buffer );
         /* change offset */
         entry_offset += font->height;
+        }
     }
     stk_display_store_rect( &chart_pos );
 }
@@ -389,6 +393,7 @@ void chart_show_compact( Set_Chart *chart, int x, int y, int w, int h )
 
     /* caption */
     ccfont->align = STK_FONT_ALIGN_LEFT | STK_FONT_ALIGN_TOP;
+    {
     char *cheader = _("Name      Level Score");
     stk_font_write( ccfont, stk_display, px, py, -1, cheader );
 	
@@ -416,6 +421,7 @@ void chart_show_compact( Set_Chart *chart, int x, int y, int w, int h )
         /* change offset */
         entry_offset += font->height - 1;
     }
+    }
     { SDL_Rect region = { x, y, w, h };
     stk_display_store_rect( &region ); }
 }
diff --git a/configure b/configure
index e3da323..eb8b692 100755
--- a/configure
+++ b/configure
@@ -11392,7 +11392,7 @@ if test "${ac_cv_lib_m_main+set}" = set; then
   echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lm  $LIBS"
+LIBS="  $LIBS"
 cat >conftest.$ac_ext <<_ACEOF
 /* confdefs.h.  */
 _ACEOF
@@ -11446,7 +11446,7 @@ if test $ac_cv_lib_m_main = yes; then
 #define HAVE_LIBM 1
 _ACEOF
 
-  LIBS="-lm $LIBS"
+  LIBS=" $LIBS"
 
 else
   { { echo "$as_me:$LINENO: error: lib math is needed" >&5
-- 
1.8.3.4


From 9c323258dc4be15ba6299abb40af19b76dbe80b8 Mon Sep 17 00:00:00 2001
From: Markus Himmel <markus@himmel-villmar.de>
Date: Tue, 13 Jan 2015 16:19:54 +0000
Subject: [PATCH 2/3] Relocate save files, high scores and config

---
 client/chart.c     |  4 ++++
 client/config.c    | 17 +++++++++++++++++
 client/editor.c    | 20 ++++++++++++++++++++
 client/lbreakout.h |  2 ++
 client/main.c      | 17 +++++++++++++++++
 client/manager.c   | 31 +++++++++++++++++++++++++++++++
 client/slot.c      | 36 ++++++++++++++++++++++++++++++++++--
 client/theme.c     | 38 ++++++++++++++++++++++++++++++++++++--
 game/levels.c      | 42 ++++++++++++++++++++++++++++++++++++++++--
 9 files changed, 201 insertions(+), 6 deletions(-)

diff --git a/client/chart.c b/client/chart.c
index 8fbd8c6..6dfe30e 100644
--- a/client/chart.c
+++ b/client/chart.c
@@ -202,15 +202,19 @@ void chart_load()
 	if ( charts ) list_delete( charts ); charts = 0;
 	charts = list_create( LIST_AUTO_DELETE, chart_set_delete );
     /* load highscore */
+#ifndef __HAIKU__
     if ( !chart_load_from_path( HI_DIR ) ) {
         fprintf( stderr, _("Unable to access highscore chart in '%s'.\n"), HI_DIR );
         fprintf( stderr, _("Trying to use config directory '%s'.\n"), config.dir_name );
+#endif
         if ( !chart_load_from_path( config.dir_name ) ) {
             fprintf( stderr, _("Unable to access highscore chart in config directory... won't be "
                              "able to save any results. Sorry.\n") );
             return;
         }
+#ifndef __HAIKU__
     }
+#endif
     printf( _("Saving highscore chart in: %s\n"), chart_path );
     /* compute size and position stuff of highscore */
     {
diff --git a/client/config.c b/client/config.c
index 83a924c..7b2ed81 100644
--- a/client/config.c
+++ b/client/config.c
@@ -21,6 +21,11 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 
+#ifdef __HAIKU__
+#include <FindDirectory.h>
+#include <fs_info.h>
+#endif
+
 #include "config.h"
 #include "../common/parser.h"
 
@@ -38,7 +43,19 @@ Config config;
 void config_check_dir()
 {
     char level_dir[512];
+#ifdef __HAIKU__
+    dev_t volume = dev_for_path("/boot");
+    if ( find_directory( B_USER_SETTINGS_DIRECTORY, volume, false,
+        config.dir_name, sizeof(config.dir_name)-1 ) == B_OK &&
+        strlen(config.dir_name) + strlen(CONFIG_DIR_NAME)
+        < sizeof(config.dir_name)-1 ) {
+        strcat(config.dir_name, "/");
+        strcat(config.dir_name, CONFIG_DIR_NAME);
+    } else
+        snprintf( config.dir_name, sizeof(config.dir_name)-1, "%s/%s", (getenv( "HOME" )?getenv( "HOME" ):"."), CONFIG_DIR_NAME );
+#else
     snprintf( config.dir_name, sizeof(config.dir_name)-1, "%s/%s", (getenv( "HOME" )?getenv( "HOME" ):"."), CONFIG_DIR_NAME );
+#endif
     /* test and create .lgames */
     if ( opendir( config.dir_name ) == 0 ) {
         fprintf( stderr, "couldn't find/open config directory '%s'\n", config.dir_name );
diff --git a/client/editor.c b/client/editor.c
index e182081..81a4b7c 100644
--- a/client/editor.c
+++ b/client/editor.c
@@ -15,6 +15,11 @@
  *                                                                         *
  ***************************************************************************/
 
+#ifdef __HAIKU__
+#include <FindDirectory.h>
+#include <fs_info.h>
+#endif
+
 #include "lbreakout.h"
 #include "../game/game.h"
 #include "game.h"
@@ -722,7 +727,22 @@ int editor_init( char *file_name )
 {
     FILE *file = 0;
     /* set full file name */
+#ifdef __HAIKU__
+    dev_t volume = dev_for_path("/boot");
+    if ( find_directory(B_USER_SETTINGS_DIRECTORY, volume, false,
+        edit_file_name, sizeof(edit_file_name)-1 ) == B_OK &&
+        strlen(edit_file_name) + strlen(CONFIG_DIR_NAME) + strlen(file_name)
+        < sizeof(edit_file_name) - 18 ) {
+        strcat(edit_file_name, "/");
+        strcat(edit_file_name, CONFIG_DIR_NAME);
+        strcat(edit_file_name, "/lbreakout2-levels/");
+        strcat(edit_file_name, file_name);
+    } else
+        snprintf( edit_file_name, sizeof(edit_file_name)-1, "%s/%s/lbreakout2-levels/%s", (getenv( "HOME" )?getenv( "HOME" ):"."), CONFIG_DIR_NAME, file_name );
+    fprintf( stderr, "HAIKU: Saving at %s\n", edit_file_name);
+#else
     snprintf( edit_file_name, sizeof(edit_file_name)-1, "%s/%s/lbreakout2-levels/%s", (getenv( "HOME" )?getenv( "HOME" ):"."), CONFIG_DIR_NAME, file_name );
+#endif
     /* test this file for write access. use append to keep contents */
     if ( ( file = fopen( edit_file_name, "a" ) ) == 0 ) {
         fprintf( stderr, "Permission to write to file '%s' denied.\n", edit_file_name );
diff --git a/client/lbreakout.h b/client/lbreakout.h
index 4b0090c..8ab9cd6 100644
--- a/client/lbreakout.h
+++ b/client/lbreakout.h
@@ -48,6 +48,8 @@ Global definitions for LBreakout and general system includes.
 /* config directory name in home directory */
 #ifdef _WIN32
 #define CONFIG_DIR_NAME "lgames"
+#elif __HAIKU__
+#define CONFIG_DIR_NAME "LGames"
 #else
 #define CONFIG_DIR_NAME ".lgames"
 #endif
diff --git a/client/main.c b/client/main.c
index 81e7f57..7f29cfc 100644
--- a/client/main.c
+++ b/client/main.c
@@ -23,6 +23,11 @@
 #include <unistd.h>
 #endif
 
+#ifdef __HAIKU__
+#include <FindDirectory.h>
+#include <fs_info.h>
+#endif
+
 #include "lbreakout.h"
 #include "../game/game.h"
 #include "file.h"
@@ -198,7 +203,19 @@ int main(int argc, char *argv[])
                 /* new set? */
                 if ( strequal( NEW_SET, edit_set ) ) {
                     editor_file = calloc( 16, sizeof( char ) );
+#ifdef __HAIKU__
+                    if ( find_directory(B_USER_SETTINGS_DIRECTORY, dev_for_path("/boot"), false,
+                        path, sizeof(path)-1 ) == B_OK &&
+                        strlen(path) + strlen(CONFIG_DIR_NAME)
+                        < sizeof(path) - 18 ) {
+                        strcat(path, "/");
+                        strcat(path, CONFIG_DIR_NAME);
+                        strcat(path, "/lbreakout2-levels");
+                    } else
+                        snprintf( path, sizeof(path)-1, "%s/%s/lbreakout2-levels", getenv( "HOME" )? getenv("HOME"):".", CONFIG_DIR_NAME );
+#else
                     snprintf( path, sizeof(path)-1, "%s/%s/lbreakout2-levels", getenv( "HOME" )? getenv("HOME"):".", CONFIG_DIR_NAME );
+#endif
                     if ( !enter_string( font, _("Set Name:"), editor_file, 12 ) || !file_check( path, editor_file, "w" ) ) {
                         free( editor_file );
                         break;
diff --git a/client/manager.c b/client/manager.c
index 5c94c38..9cbbcdd 100644
--- a/client/manager.c
+++ b/client/manager.c
@@ -15,6 +15,11 @@
  *                                                                         *
  ***************************************************************************/
 
+#ifdef __HAIKU__
+#include <FindDirectory.h>
+#include <fs_info.h>
+#endif
+
 #include "manager.h"
 #include "../game/game.h"
 #include "file.h"
@@ -278,7 +283,19 @@ void levelsets_load_names()
         delete_text( text );
     }
     /* parse home directory */
+#ifdef __HAIKU__
+    if ( find_directory( B_USER_SETTINGS_DIRECTORY, dev_for_path("/boot"), false,
+        level_dir, sizeof(level_dir)-1 ) == B_OK &&
+        strlen(level_dir) + strlen(CONFIG_DIR_NAME)
+        < sizeof(level_dir)-19 ) {
+        strcat(level_dir, "/");
+        strcat(level_dir, CONFIG_DIR_NAME);
+        strcat(level_dir, "/lbreakout2-levels");
+    } else
+        snprintf( level_dir, sizeof(level_dir)-1, "%s/%s/lbreakout2-levels", (getenv( "HOME" )?getenv( "HOME" ):"."), CONFIG_DIR_NAME );
+#else
     snprintf( level_dir, sizeof(level_dir)-1, "%s/%s/lbreakout2-levels", (getenv( "HOME" )?getenv( "HOME" ):"."), CONFIG_DIR_NAME );
+#endif
     if ( ( text = get_file_list( level_dir, 0, level_dir ) ) ) {
         for ( i = 0; i < text->count; i++ ) {
             /* filter stuff */
@@ -353,7 +370,21 @@ void cb_delete_set()
         return;
     }
     /* get file name + path */
+#ifdef __HAIKU__
+    if ( find_directory( B_USER_SETTINGS_DIRECTORY, dev_for_path("/boot"), false,
+        fname, sizeof(fname)-1 ) == B_OK &&
+        strlen(fname) + strlen(CONFIG_DIR_NAME)
+        + strlen(levelset_names_home[config.levelset_id_home])
+        < sizeof(fname)-19 ) {
+        strcat(fname, "/");
+        strcat(fname, CONFIG_DIR_NAME);
+        strcat(fname, "/lbreakout2-levels/");
+        strcat(fname, levelset_names_home[config.levelset_id_home]);
+    } else
+        snprintf( fname, sizeof(fname)-1,"%s/%s/lbreakout2-levels/%s", getenv( "HOME" ), CONFIG_DIR_NAME, levelset_names_home[config.levelset_id_home] );
+#else
     snprintf( fname, sizeof(fname)-1,"%s/%s/lbreakout2-levels/%s", getenv( "HOME" ), CONFIG_DIR_NAME, levelset_names_home[config.levelset_id_home] );
+#endif
     remove( fname );
     levelsets_load_names(); /* reinit name lists and configs indices */
     /* reassign these name lists as position in memory has changed */
diff --git a/client/slot.c b/client/slot.c
index 238d4c8..a32805a 100644
--- a/client/slot.c
+++ b/client/slot.c
@@ -15,15 +15,34 @@
  *                                                                         *
  ***************************************************************************/
 
+#ifdef __HAIKU__
+#include <FindDirectory.h>
+#include <fs_info.h>
+#endif
+
 #include "lbreakout.h"
 #include "slot.h"
 
 static FILE *open_slot( int id, char *mode )
 {
     char fname[512];
-    snprintf( fname, 511, "%s/%s/lbr2_save_%d", 
-              (getenv( "HOME" )?getenv( "HOME" ):"."), 
+#ifdef __HAIKU__
+    dev_t volume = dev_for_path("/boot");
+    if ( find_directory(B_USER_SETTINGS_DIRECTORY, volume, false,
+        fname, sizeof(fname)-1 ) == B_OK && strlen(fname) +
+        strlen(CONFIG_DIR_NAME) < sizeof(fname) - 16 ) {
+        off_t len = strlen(fname);
+        snprintf( fname+len, 511-len, "/%s/lbr2_save_%d", CONFIG_DIR_NAME, id);
+	} else
+        snprintf( fname, 511, "%s/%s/lbr2_save_%d",
+              (getenv( "HOME" )?getenv( "HOME" ):"."),
               CONFIG_DIR_NAME, id );
+    fprintf( stderr, "HAIKU: Accessing savefile at %s\n", fname );
+#else
+    snprintf( fname, 511, "%s/%s/lbr2_save_%d",
+              (getenv( "HOME" )?getenv( "HOME" ):"."),
+              CONFIG_DIR_NAME, id );
+#endif
     //printf( "accessing '%s' in mode '%s'\n", fname, mode );
     return fopen( fname, mode );
 }
@@ -62,9 +81,22 @@ int slot_save( int slot_id, GameSlot *gs )
 int slot_delete( int slot_id )
 {
     char fname[512];
+#ifdef __HAIKU__
+    dev_t volume = dev_for_path("/boot");
+    if ( find_directory(B_USER_SETTINGS_DIRECTORY, volume, false,
+        fname, sizeof(fname)-1 ) == B_OK && strlen(fname) +
+        strlen(CONFIG_DIR_NAME) < sizeof(fname) - 16 ) {
+        off_t len = strlen(fname);
+        snprintf( fname+len, 511-len, "/%s/lbr2_save_%d", CONFIG_DIR_NAME, slot_id);
+    } else
+        snprintf( fname, 511, "%s/%s/lbr2_save_%d",
+              (getenv( "HOME" )?getenv( "HOME" ):"."),
+              CONFIG_DIR_NAME, slot_id );
+#else
     snprintf( fname, 511, "%s/%s/lbr2_save_%d", 
               (getenv( "HOME" )?getenv( "HOME" ):"."), 
               CONFIG_DIR_NAME, slot_id );
+#endif
     if ( remove(fname) != 0 )
     {
         fprintf( stderr, "ERROR: couldn't delete file %s\n", fname );
diff --git a/client/theme.c b/client/theme.c
index ad6de96..a0e1b8e 100644
--- a/client/theme.c
+++ b/client/theme.c
@@ -15,6 +15,11 @@
  *                                                                         *
  ***************************************************************************/
 
+#ifdef __HAIKU__
+#include <FindDirectory.h>
+#include <fs_info.h>
+#endif
+
 #include <sys/types.h>
 #include <unistd.h>
 #include <sys/stat.h>
@@ -133,10 +138,25 @@ static char theme_dir[512];
 static char theme_path[512];
 void theme_set_dir( char *name )
 {
-    if ( name[0] == '~' )
+    if ( name[0] == '~' ) {
+#ifdef __HAIKU__
+        dev_t volume = dev_for_path("/boot");
+        if ( find_directory( B_USER_SETTINGS_DIRECTORY, volume, false,
+            theme_dir, sizeof(theme_dir)-1 ) == B_OK &&
+            strlen(theme_dir) + strlen(CONFIG_DIR_NAME) + strlen(name)
+            < sizeof(theme_dir)-19 ) {
+            strcat(theme_dir, "/");
+            strcat(theme_dir, CONFIG_DIR_NAME);
+            strcat(theme_dir, "/lbreakout2-themes/");
+            strcat(theme_dir, name + (off_t)1);
+        } else
+            snprintf( theme_dir, sizeof(theme_dir)-1, "%s/%s/lbreakout2-themes/%s",
+                     (getenv( "HOME" )?getenv( "HOME" ):"."), CONFIG_DIR_NAME, name + 1 );
+#else
         snprintf( theme_dir, sizeof(theme_dir)-1, "%s/%s/lbreakout2-themes/%s", 
                  (getenv( "HOME" )?getenv( "HOME" ):"."), CONFIG_DIR_NAME, name + 1 );
-    else {
+#endif
+    } else {
         if ( STRCMP( SRC_DIR, "." ) ) {
             getcwd( theme_dir, 511 );
             strcat( theme_dir, "/gfx/" );
@@ -327,6 +347,20 @@ void theme_get_list()
         closedir( hdir );
     }
     /* home theme directory */
+#ifdef __HAIKU__
+    if ( find_directory( B_USER_SETTINGS_DIRECTORY, dev_for_path("/boot"), false,
+        dir, sizeof(dir)-1 ) == B_OK &&
+        strlen(dir) + strlen(CONFIG_DIR_NAME)
+        < sizeof(dir)-19 ) {
+        strcat(dir, "/");
+        strcat(dir, CONFIG_DIR_NAME);
+        strcat(dir, "/lbreakout2-themes");
+    } else
+        snprintf( dir, sizeof(dir)-1, "%s/%s/lbreakout2-themes", (getenv( "HOME" )?getenv( "HOME" ):"."), CONFIG_DIR_NAME );
+#else
+    snprintf( dir, sizeof(dir)-1, "%s/%s/lbreakout2-themes", (getenv( "HOME" )?getenv( "HOME" ):"."), CONFIG_DIR_NAME );
+#endif
+
     snprintf( dir, sizeof(dir)-1, "%s/%s/lbreakout2-themes", (getenv( "HOME" )?getenv( "HOME" ):"."), CONFIG_DIR_NAME );
     if ( ( hdir = opendir( dir ) ) != 0 ) {
         while ( ( entry = readdir( hdir ) ) ) {
diff --git a/game/levels.c b/game/levels.c
index a93a633..0d728ac 100644
--- a/game/levels.c
+++ b/game/levels.c
@@ -15,6 +15,11 @@
  *                                                                         *
  ***************************************************************************/
 
+#ifdef __HAIKU__
+#include <FindDirectory.h>
+#include <fs_info.h>
+#endif
+
 #include "levels.h"
 
 /*
@@ -66,9 +71,26 @@ FILE *levelset_open( const char *fname, char *mode )
 	FILE *file;
 	char path[512];
 	if ( fname[0] == '~' ) {
-		snprintf( path, sizeof(path)-1, "%s/%s/lbreakout2-levels/%s", 
-			(getenv( "HOME" )?getenv( "HOME" ):"."), 
+#ifdef __HAIKU__
+        if ( find_directory( B_USER_SETTINGS_DIRECTORY, dev_for_path("/boot"), false,
+            path, sizeof(path)-1 ) == B_OK &&
+            strlen(path) + strlen(CONFIG_DIR_NAME)
+            + strlen(fname)
+            < sizeof(path)-19 ) {
+            strcat(path, "/");
+            strcat(path, CONFIG_DIR_NAME);
+            strcat(path, "/lbreakout2-levels/");
+            strcat(path, fname + 1);
+        } else
+			snprintf( path, sizeof(path)-1, "%s/%s/lbreakout2-levels/%s",
+				(getenv( "HOME" )?getenv( "HOME" ):"."),
+				CONFIG_DIR_NAME, fname + 1 );
+	fprintf ( stderr, "HAIKU: opening %s\n", path );
+#else
+		snprintf( path, sizeof(path)-1, "%s/%s/lbreakout2-levels/%s",
+			(getenv( "HOME" )?getenv( "HOME" ):"."),
 			CONFIG_DIR_NAME, fname + 1 );
+#endif
 	}
 	else
 	if ( fname[0] != '/' ) /* keep global pathes */
@@ -276,9 +298,25 @@ int levelset_save( LevelSet *set, char *fname )
 
 	if ( set == 0 || set->count == 0 ) return 0;
 
+#ifdef __HAIKU__
+	if ( find_directory( B_USER_SETTINGS_DIRECTORY, dev_for_path("/boot"), false,
+		path, sizeof(path)-1 ) == B_OK &&
+		strlen(path) + strlen(CONFIG_DIR_NAME)
+		+ strlen(fname)
+		< sizeof(path)-19 ) {
+		strcat(path, "/");
+		strcat(path, CONFIG_DIR_NAME);
+		strcat(path, "/lbreakout2-levels/");
+		strcat(path, (fname[0]=='~') ? fname + 1 : fname);
+		} else
+			snprintf( path, sizeof(path)-1, "%s/%s/lbreakout2-levels/%s", 
+				(getenv( "HOME" )?getenv( "HOME" ):"."), 
+				CONFIG_DIR_NAME, (fname[0]=='~')?fname+1:fname );
+#else
 	snprintf( path, sizeof(path)-1, "%s/%s/lbreakout2-levels/%s", 
 			(getenv( "HOME" )?getenv( "HOME" ):"."), 
 			CONFIG_DIR_NAME, (fname[0]=='~')?fname+1:fname );
+#endif
 	if ( ( file = fopen( path, "w" ) ) == 0 ) {
 		fprintf( stderr, "couldn't open %s\n", path );
 		return 0;
-- 
1.8.3.4


From 18758854c84c8fc8e12ce85ecf441b278aaa0d59 Mon Sep 17 00:00:00 2001
From: Markus Himmel <markus@himmel-villmar.de>
Date: Wed, 14 Jan 2015 18:23:21 +0000
Subject: [PATCH 3/3] Add updated icon

---
 LBreakout2.rdef | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/LBreakout2.rdef b/LBreakout2.rdef
index 6b165ae..69a4652 100644
--- a/LBreakout2.rdef
+++ b/LBreakout2.rdef
@@ -18,16 +18,17 @@ resource app_version {
 };
 
 resource vector_icon {
-	$"6E63696605020106023D5738B7D6E13769AC3CF83249ADC94642AAFFA5040400"
-	$"FF9E9E02000205B6B6DB3925EEBD5FCABAE8BF4A54944AC9EB00846C1BFF34B6"
-	$"9627FF77DBCD5CF983C9C088FFFE6A5716FF020106023B7084B697593638963A"
-	$"F2BB4202AB49ECC600AAD2A5F440503F050001010000850502044C24C62E24C2"
+	$"6E63696605020106023D5FC8326AB4B225F53CFFCE4A14594559B7FFA5040400"
+	$"FF9E9E02000205B6B6DB3925EEBD5FCABAE8BF4A54944AC9EB00FFCD22FF34EA"
+	$"BE26FF77F1D806F983E5D882FFFEC2A43EFF020106023B7084B697593638963A"
+	$"F2BB44015549CCC600AAD2A5F440503F050001010000850502044C24C62E24C2"
 	$"E124442C44B62144B96E4C34C2E134C62E34542C54B96E54B6210604AF303937"
-	$"3C2B3A2948243E2D4A48584E450204B6C93AB8A73AB4EA3AB365C0BFB365BEE0"
-	$"B365C29DB6C94BB4EA4BB8A74B32C0BF32C29D32BEE006033E402E5037423A50"
-	$"374438493B3F330606BE0F3039233D27352242294822452948445654574E5C5B"
-	$"504E4555474642090A0401042028220A0301041001178500040A020102024000"
-	$"000000000000003FC3C3400000BDC3C30A010101000A02010202404DAB000000"
-	$"000000404DAB4A26D645D13D0A000100000A0301001001178100040A03010300"
-	$"0A030103023EC27B0000000000003EC27B46388E46B10D"
+	$"3C2B3A2948243E2D4A48584E450204B6C93AB86F3AB5223AB3CBC0BFB3CBBEE0"
+	$"B3CBC29DB6C94BB5224BB86F4B31C0BF31C29D31BEE006033E402E5037423A50"
+	$"374438493B3F330606BE0F3039243D28352342294822452948445653574D5C5A"
+	$"504E4555474642090A040104023FFB5DB90A98390A983FFB5D4347234571E30A"
+	$"03010430222001178500040A020102024000000000000000003FC3C3430000BD"
+	$"C3C30A0101012022200A02010202404DAB000000000000404DAB4A46D645D13D"
+	$"0A0001002022200A03010030222001178100040A0301032022200A030103023E"
+	$"C27B0000000000003EC27B46B88E46B10D"
 };
-- 
1.8.3.4

