[gcompris-devel] [PATCH] Support GNUCHESS environment variable

Aleksey Lim alsroot at member.fsf.org
Wed May 26 05:40:54 UTC 2010


Will be useful in 0install environment when GnuChess is installed from 0install feed.
---
 src/chess_computer-activity/chess.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/chess_computer-activity/chess.c b/src/chess_computer-activity/chess.c
index 27e02c4..31a33de 100644
--- a/src/chess_computer-activity/chess.c
+++ b/src/chess_computer-activity/chess.c
@@ -229,12 +229,15 @@ static void start_board (GcomprisBoard *agcomprisBoard)
 {
 
   gchar **gnuchess_pathptr = gnuchess_path;
-  gchar *gnuchess_bin = NULL;
+  gchar *gnuchess_bin = g_strdup(getenv("GNUCHESS"));
 
 
   do
     {
-      if(*gnuchess_pathptr[0] == '/')
+      if(gnuchess_bin != NULL)
+	{
+	}
+      else if(*gnuchess_pathptr[0] == '/')
 	{
 	  gnuchess_bin = strdup(*gnuchess_pathptr);
 	}
@@ -251,6 +254,7 @@ static void start_board (GcomprisBoard *agcomprisBoard)
 
       gnuchess_pathptr++;
       g_free(gnuchess_bin);
+      gnuchess_bin = NULL;
     } while(*gnuchess_pathptr != NULL);
 
   if(*gnuchess_pathptr == NULL)
-- 
1.7.0.4





More information about the Gcompris-devel mailing list