r3886 - packages/trunk/parsec47/debian/patches

Peter De Wachter pdewacht-guest at alioth.debian.org
Sun Aug 26 22:58:02 UTC 2007


Author: pdewacht-guest
Date: 2007-08-26 22:58:02 +0000 (Sun, 26 Aug 2007)
New Revision: 3886

Added:
   packages/trunk/parsec47/debian/patches/dotfile.patch
Modified:
   packages/trunk/parsec47/debian/patches/fixes.patch
   packages/trunk/parsec47/debian/patches/series
Log:
put prefs in dotfile in homedir


Added: packages/trunk/parsec47/debian/patches/dotfile.patch
===================================================================
--- packages/trunk/parsec47/debian/patches/dotfile.patch	                        (rev 0)
+++ packages/trunk/parsec47/debian/patches/dotfile.patch	2007-08-26 22:58:02 UTC (rev 3886)
@@ -0,0 +1,63 @@
+Index: parsec47_0.2.dfsg1/src/abagames/p47/P47PrefManager.d
+===================================================================
+--- parsec47_0.2.dfsg1.orig/src/abagames/p47/P47PrefManager.d	2007-08-26 23:59:46.000000000 +0200
++++ parsec47_0.2.dfsg1/src/abagames/p47/P47PrefManager.d	2007-08-27 00:01:29.000000000 +0200
+@@ -7,6 +7,8 @@
+ 
+ private:
+ import std.stream;
++import std.string;
++import std.c.stdlib;
+ import abagames.util.PrefManager;
+ 
+ /**
+@@ -16,7 +18,7 @@
+  public:
+   static const int PREV_VERSION_NUM = 10;
+   static const int VERSION_NUM = 20;
+-  static const char[] PREF_FILE = "p47.prf";
++  static const char[] PREF_FILE = ".p47.prf";
+   static const int MODE_NUM = 2;
+   static const int DIFFICULTY_NUM = 4;
+   static const int REACHED_PARSEC_SLOT_NUM = 10;
+@@ -24,6 +26,13 @@
+   int reachedParsec[MODE_NUM][DIFFICULTY_NUM];
+   int selectedDifficulty, selectedParsecSlot, selectedMode;
+ 
++  public static char[] home_dir() {
++    char * home = getenv("HOME");
++    if (home is null)
++      throw new Error("HOME environment variable is not defined");
++    return std.string.toString(home);
++  }
++
+   private void init() {
+     for (int k = 0; k < MODE_NUM; k++) {
+       for (int i = 0; i < DIFFICULTY_NUM; i++) {
+@@ -53,7 +62,7 @@
+     auto File fd = new File;
+     try {
+       int ver;
+-      fd.open(PREF_FILE);
++      fd.open(home_dir() ~ "/" ~ PREF_FILE);
+       fd.read(ver);
+       if (ver == PREV_VERSION_NUM) {
+ 	init();
+@@ -74,7 +83,7 @@
+       fd.read(selectedDifficulty);
+       fd.read(selectedParsecSlot);
+       fd.read(selectedMode);
+-    } catch (Error e) {
++    } catch (Exception e) {
+       init();
+     } finally {
+       fd.close();
+@@ -83,7 +92,7 @@
+ 
+   public void save() {
+     auto File fd = new File;
+-    fd.create(PREF_FILE);
++    fd.create(home_dir ~ "/" ~ PREF_FILE);
+     fd.write(VERSION_NUM);
+     for (int k = 0; k < MODE_NUM; k++) {
+       for (int i = 0; i < DIFFICULTY_NUM; i++) {

Modified: packages/trunk/parsec47/debian/patches/fixes.patch
===================================================================
--- packages/trunk/parsec47/debian/patches/fixes.patch	2007-08-26 22:52:24 UTC (rev 3885)
+++ packages/trunk/parsec47/debian/patches/fixes.patch	2007-08-26 22:58:02 UTC (rev 3886)
@@ -2400,21 +2400,6 @@
      if (left < 0)
        return;
      LetterRender.drawString("LEFT", 520, 260, 25, LetterRender.TO_DOWN);
-Index: parsec47.0.2.dfsg1/src/abagames/p47/P47PrefManager.d
-===================================================================
---- parsec47.0.2.dfsg1.orig/src/abagames/p47/P47PrefManager.d	2004-01-01 20:26:42.000000000 +0000
-+++ parsec47.0.2.dfsg1/src/abagames/p47/P47PrefManager.d	2007-08-26 19:56:17.000000000 +0000
-@@ -53,6 +53,10 @@
-     auto File fd = new File;
-     try {
-       int ver;
-+//      if (exists(PREF_FILE) == 0){
-+  //      init();
-+    //    save();
-+      //}
-       fd.open(PREF_FILE);
-       fd.read(ver);
-       if (ver == PREV_VERSION_NUM) {
 Index: parsec47.0.2.dfsg1/src/abagames/p47/P47Screen.d
 ===================================================================
 --- parsec47.0.2.dfsg1.orig/src/abagames/p47/P47Screen.d	2004-01-01 20:26:42.000000000 +0000

Modified: packages/trunk/parsec47/debian/patches/series
===================================================================
--- packages/trunk/parsec47/debian/patches/series	2007-08-26 22:52:24 UTC (rev 3885)
+++ packages/trunk/parsec47/debian/patches/series	2007-08-26 22:58:02 UTC (rev 3886)
@@ -1,3 +1,4 @@
 fixes.patch
 directories.patch
 windowed.patch
+dotfile.patch




More information about the Pkg-games-commits mailing list