summaryrefslogtreecommitdiff
path: root/x11/xplanet/patches/patch-ag
blob: a45ee12e3fe4897947700a17123d90152ae60670 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
$NetBSD: patch-ag,v 1.1 2002/04/04 16:47:55 atatat Exp $

Add support for $XPLANET/images and $HOME/.xplanet/images images, etc.

--- libdisplay/DisplayBase.cc.orig	Tue Jan 22 21:07:42 2002
+++ libdisplay/DisplayBase.cc	Tue Apr  2 22:43:04 2002
@@ -208,6 +208,40 @@
         return(1);
     }
 
+    char *xplanet = getenv("XPLANET");
+    if (xplanet != NULL)
+    {
+        newfont = xplanet;
+        newfont += separator;
+        newfont += "fonts";
+        newfont += separator;
+        newfont += fontname;
+
+        if (fileExists(newfont))
+        {
+            fontname = newfont;
+            return(true);
+        }
+    }
+
+    char *home = getenv("HOME");
+    if (home != NULL)
+    {
+        newfont = home;
+        newfont += separator;
+        newfont += ".xplanet";
+        newfont += separator;
+        newfont += "fonts";
+        newfont += separator;
+        newfont += fontname;
+
+        if (fileExists(newfont))
+        {
+            fontname = newfont;
+            return(true);
+        }
+    }
+
     newfont = prefix;
     newfont += separator;
     newfont += "fonts";
@@ -533,6 +567,32 @@
     string rgbfile = "rgb.txt";
 
     ifstream infile(rgbfile.c_str());
+    if (infile.bad())
+    {
+        char *xplanet = getenv("XPLANET");
+        if (xplanet != NULL)
+        {
+            infile.close();
+            rgbfile = xplanet;
+            rgbfile += separator;
+            rgbfile += "rgb.txt";
+            infile.open(rgbfile.c_str());
+        }
+    }
+    if (infile.bad())
+    {
+        char *home = getenv("HOME");
+        if (home != NULL)
+        {
+            infile.close();
+            rgbfile = home;
+            rgbfile += separator;
+            rgbfile += ".xplanet";
+            rgbfile += separator;
+            rgbfile += "rgb.txt";
+            infile.open(rgbfile.c_str());
+        }
+    }
     if (infile.bad()) 
     {
         infile.close();