[gnome-games/glchess-vala] Log AI profiles better



commit 91c875883f9d128c6627972df5123a63352a0d6f
Author: Robert Ancell <robert ancell canonical com>
Date:   Thu Jan 13 13:00:57 2011 -0600

    Log AI profiles better

 glchess/src/ai-profile.vala |   29 +++++++++++++++++------------
 glchess/src/glchess.vala    |    2 +-
 2 files changed, 18 insertions(+), 13 deletions(-)
---
diff --git a/glchess/src/ai-profile.vala b/glchess/src/ai-profile.vala
index 728ba4c..07cb636 100644
--- a/glchess/src/ai-profile.vala
+++ b/glchess/src/ai-profile.vala
@@ -1,3 +1,15 @@
+public class AIProfile
+{
+    public string name;
+    public string protocol;
+    public string binary;
+    public string path;
+    public string args = "";
+    public string[] easy_options;
+    public string[] normal_options;
+    public string[] hard_options;
+}
+
 public List<AIProfile> load_ai_profiles (string filename)
 {
    var profiles = new List<AIProfile> ();
@@ -38,8 +50,12 @@ public List<AIProfile> load_ai_profiles (string filename)
            continue;
        }
 
-       if (Environment.find_program_in_path (profile.binary) != null)
+       var path = Environment.find_program_in_path (profile.binary);
+       if (path != null)
+       {
+           profile.path = path;
            profiles.append (profile);
+       }
    }
 
    return profiles;
@@ -57,14 +73,3 @@ private string[] load_options (KeyFile file, string name, string difficulty) thr
 
     return options;
 }
-
-public class AIProfile
-{
-    public string name;
-    public string protocol;
-    public string binary;
-    public string args = "";
-    public string[] easy_options;
-    public string[] normal_options;
-    public string[] hard_options;
-}
diff --git a/glchess/src/glchess.vala b/glchess/src/glchess.vala
index e34aa72..8a18b92 100644
--- a/glchess/src/glchess.vala
+++ b/glchess/src/glchess.vala
@@ -317,7 +317,7 @@ public class Application
     {
         ai_profiles = load_ai_profiles (Path.build_filename (Config.PKGDATADIR, "engines.conf", null));
         foreach (var profile in ai_profiles)
-            message ("Detected AI profile %s", profile.name);
+            message ("Detected AI profile %s in %s", profile.name, profile.path);
 
         if (game == null)
         {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]