r3870 - packages/trunk/torus-trooper/debian/patches
Peter De Wachter
pdewacht-guest at alioth.debian.org
Sun Aug 26 20:39:33 UTC 2007
Author: pdewacht-guest
Date: 2007-08-26 20:39:33 +0000 (Sun, 26 Aug 2007)
New Revision: 3870
Added:
packages/trunk/torus-trooper/debian/patches/dotfile.patch
Modified:
packages/trunk/torus-trooper/debian/patches/series
Log:
put preference & replay files in ~/.torus-trooper
Added: packages/trunk/torus-trooper/debian/patches/dotfile.patch
===================================================================
--- packages/trunk/torus-trooper/debian/patches/dotfile.patch (rev 0)
+++ packages/trunk/torus-trooper/debian/patches/dotfile.patch 2007-08-26 20:39:33 UTC (rev 3870)
@@ -0,0 +1,82 @@
+Index: torus-trooper_0.22.dfsg1/src/abagames/tt/prefmanager.d
+===================================================================
+--- torus-trooper_0.22.dfsg1.orig/src/abagames/tt/prefmanager.d 2007-08-26 22:37:04.000000000 +0200
++++ torus-trooper_0.22.dfsg1/src/abagames/tt/prefmanager.d 2007-08-26 22:37:09.000000000 +0200
+@@ -6,6 +6,9 @@
+ module abagames.tt.prefmanager;
+
+ private import std.stream;
++private import std.string;
++private import std.file;
++private import std.c.stdlib;
+ private import abagames.util.prefmanager;
+ private import abagames.tt.ship;
+
+@@ -22,11 +25,20 @@
+ _prefData = new PrefData;
+ }
+
++ public static char[] pref_dir() {
++ char[] dir = std.string.toString(getenv("HOME")) ~ "/.torus-trooper";
++ try {
++ mkdir(dir);
++ } catch (FileException e) {
++ }
++ return dir;
++ }
++
+ public void load() {
+ auto File fd = new File;
+ try {
+ int ver;
+- fd.open(PREF_FILE);
++ fd.open(pref_dir() ~ "/" ~ PREF_FILE);
+ fd.read(ver);
+ if (ver != VERSION_NUM)
+ throw new Error("Wrong version num");
+@@ -41,7 +53,7 @@
+
+ public void save() {
+ auto File fd = new File;
+- fd.create(PREF_FILE);
++ fd.create(pref_dir() ~ "/" ~ PREF_FILE);
+ fd.write(VERSION_NUM);
+ _prefData.save(fd);
+ fd.close();
+Index: torus-trooper_0.22.dfsg1/src/abagames/tt/replay.d
+===================================================================
+--- torus-trooper_0.22.dfsg1.orig/src/abagames/tt/replay.d 2007-08-26 22:37:04.000000000 +0200
++++ torus-trooper_0.22.dfsg1/src/abagames/tt/replay.d 2007-08-26 22:37:51.000000000 +0200
+@@ -7,13 +7,13 @@
+
+ private import std.stream;
+ private import abagames.util.sdl.recordablepad;
++private import abagames.tt.prefmanager;
+
+ /**
+ * Manage a replay data.
+ */
+ public class ReplayData {
+ public:
+- static const char[] dir = "replay";
+ static const int VERSION_NUM = 20;
+ PadRecord padRecord;
+ float level;
+@@ -23,7 +23,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(level);
+ fd.write(grade);
+@@ -34,7 +34,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/torus-trooper/debian/patches/series
===================================================================
--- packages/trunk/torus-trooper/debian/patches/series 2007-08-26 20:29:17 UTC (rev 3869)
+++ packages/trunk/torus-trooper/debian/patches/series 2007-08-26 20:39:33 UTC (rev 3870)
@@ -1,3 +1,4 @@
fixes.patch
directories.patch
windowed.patch
+dotfile.patch
More information about the Pkg-games-commits
mailing list