Package: gltron / 0.70final-12

debian-datapath.patch Patch series | download
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
Description: Finds the installed data correctly on a Debian system without going
 through a complicated process.
--- gltron-0.70final.orig/nebu/filesystem/findpath.c
+++ gltron-0.70final/nebu/filesystem/findpath.c
@@ -39,66 +39,7 @@
 #if !defined(WIN32) && !defined(macintosh) && !defined(__APPLE__)
 void goto_installpath(const char *argv0)
 {
-    char temppath[PATH_MAX];
-    char datapath[PATH_MAX];
-    char *home;
-
-    home = getenv("HOME");
-    if ( ! home ) {
-        home = ".";
-    }
-
-    strncpy(temppath, argv0, PATH_MAX); 
-    if ( ! strrchr(temppath, '/') ) {
-        char *path;
-        char *last;
-        int found;
-
-        found = 0;
-        path = getenv("PATH");
-        do {
-            /* Initialize our filename variable */
-            temppath[0] = '\0';
-
-            /* Get next entry from path variable */
-            last = strchr(path, ':');
-            if ( ! last )
-                last = path+strlen(path);
-
-            /* Perform tilde expansion */
-            if ( *path == '~' ) {
-                strcpy(temppath, home);
-                ++path;
-            }
-
-            /* Fill in the rest of the filename */
-            if ( last > (path+1) ) {
-                strncat(temppath, path, (last-path));
-                strcat(temppath, "/");
-            }
-            strcat(temppath, "./");
-            strcat(temppath, argv0);
-
-            /* See if it exists, and update path */
-            if (access(temppath, X_OK) == 0) {
-                ++found;
-            }
-            path = last+1;
-
-        } while ( *last && !found );
-
-    } else {
-        /* Increment argv0 to the basename */
-        argv0 = strrchr(argv0, '/')+1;
-    }
-
-    /* Now canonicalize it to a full pathname for the data path */
-    datapath[0] = '\0';
-    if ( realpath(temppath, datapath) ) {
-        /* There should always be '/' in the path */
-        *(strrchr(datapath, '/')) = '\0';
-    }
-    if ( ! *datapath || (chdir(datapath) < 0) ) {
+    if (chdir("/usr/share/games/gltron") < 0) {
         fprintf(stderr, "Couldn't change to install directory\n");
         exit(1); /* OK: critical, installation corrupt */
     }