r3879 - packages/trunk/mu-cade/debian/patches

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


Author: pdewacht-guest
Date: 2007-08-26 21:13:22 +0000 (Sun, 26 Aug 2007)
New Revision: 3879

Added:
   packages/trunk/mu-cade/debian/patches/dotfile.patch
Modified:
   packages/trunk/mu-cade/debian/patches/series
Log:
Put preferences and replay data in ~/.mu-cade


Added: packages/trunk/mu-cade/debian/patches/dotfile.patch
===================================================================
--- packages/trunk/mu-cade/debian/patches/dotfile.patch	                        (rev 0)
+++ packages/trunk/mu-cade/debian/patches/dotfile.patch	2007-08-26 21:13:22 UTC (rev 3879)
@@ -0,0 +1,85 @@
+Index: mu-cade_0.11.dfsg1/src/abagames/mcd/prefmanager.d
+===================================================================
+--- mu-cade_0.11.dfsg1.orig/src/abagames/mcd/prefmanager.d	2007-08-26 23:02:41.000000000 +0200
++++ mu-cade_0.11.dfsg1/src/abagames/mcd/prefmanager.d	2007-08-26 23:11:26.000000000 +0200
+@@ -6,6 +6,9 @@
+ module abagames.mcd.prefmanager;
+ 
+ private import std.stream;
++private import std.string;
++private import std.file;
++private import std.c.stdlib;
+ private import abagames.util.prefmanager;
+ 
+ /**
+@@ -21,11 +24,23 @@
+     _prefData = new PrefData;
+   }
+ 
++  public static char[] pref_dir() {
++    char * home = getenv("HOME");
++    if (home is null)
++      throw new Error("HOME environment variable undefined");
++    char[] dir = std.string.toString(home) ~ "/.mu-cade";
++    try {
++      mkdir(dir);
++    } catch (FileException e) {
++    }
++    return dir;
++  }
++
+   public void load() {
+     auto File fd = new File;
+     try {
+       int ver;
+-      fd.open(PREF_FILE_NAME);
++      fd.open(pref_dir() ~ "/" ~ PREF_FILE_NAME);
+       fd.read(ver);
+       if (ver != VERSION_NUM)
+         throw new Error("Wrong version num");
+@@ -41,7 +56,7 @@
+ 
+   public void save() {
+     auto File fd = new File;
+-    fd.create(PREF_FILE_NAME);
++    fd.create(pref_dir ~ "/" ~ PREF_FILE_NAME);
+     fd.write(VERSION_NUM);
+     _prefData.save(fd);
+     fd.close();
+Index: mu-cade_0.11.dfsg1/src/abagames/mcd/replay.d
+===================================================================
+--- mu-cade_0.11.dfsg1.orig/src/abagames/mcd/replay.d	2007-08-26 23:02:41.000000000 +0200
++++ mu-cade_0.11.dfsg1/src/abagames/mcd/replay.d	2007-08-26 23:02:46.000000000 +0200
+@@ -9,13 +9,13 @@
+ private import abagames.util.sdl.recordableinput;
+ private import abagames.util.sdl.twinstickpad;
+ private import abagames.mcd.gamemanager;
++private import abagames.mcd.prefmanager;
+ 
+ /**
+  * Save/Load a replay data.
+  */
+ public class ReplayData {
+  public:
+-  static const char[] dir = "replay";
+   static const int VERSION_NUM = 10;
+   InputRecord!(TwinStickPadState) twinStickPadInputRecord;
+   long seed;
+@@ -25,7 +25,7 @@
+ 
+   public void save(char[] fileName) {
+     auto File fd = new File;
+-    fd.create(dir ~ "/" ~ fileName);
++    fd.create(PrefManager.pref_dir() ~ "/" ~ fileName);
+     fd.write(VERSION_NUM);
+     fd.write(seed);
+     fd.write(score);
+@@ -36,7 +36,7 @@
+ 
+   public void load(char[] fileName) {
+     auto File fd = new File;
+-    fd.open(dir ~ "/" ~ fileName);
++    fd.open(PrefManager.pref_dir() ~ "/" ~ fileName);
+     int ver;
+     fd.read(ver);
+     if (ver != VERSION_NUM)

Modified: packages/trunk/mu-cade/debian/patches/series
===================================================================
--- packages/trunk/mu-cade/debian/patches/series	2007-08-26 21:01:15 UTC (rev 3878)
+++ packages/trunk/mu-cade/debian/patches/series	2007-08-26 21:13:22 UTC (rev 3879)
@@ -1,3 +1,4 @@
 fixes.patch
 directories.patch
 windowed.patch
+dotfile.patch




More information about the Pkg-games-commits mailing list