Package: dvdisaster / 0.79.5-10

19-show-text-files-with-abs-path.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
From: Carlos Maddela <e7appew@gmail.com>
Date: Wed, 21 Dec 2016 09:08:05 +1100
Subject: Allow ShowTextFile() to work with absolute path names.

Description: Allow ShowTextFile() to work with absolute path names.
Author: Carlos Maddela <e7appew@gmail.com>
Forwarded: no
Last-Update: 2016-12-21
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
---
 help-dialogs.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/help-dialogs.c b/help-dialogs.c
index 0f4e3b2..6214429 100644
--- a/help-dialogs.c
+++ b/help-dialogs.c
@@ -423,6 +423,24 @@ char *find_file(char *file, size_t *size, char *lang)
       lang_suffix[1] = lang[1];
    }
 
+   /* Test for absolute path first. */
+   if(*file == '/')
+   {
+      if(lang)
+	 path = g_strdup_printf("%s.%s", file, lang_suffix);
+      else
+	 path = g_strdup(file);
+
+      if(LargeStat(path, &stat_size))
+      {
+	 *size = stat_size;
+	 return path;
+      }
+
+      g_free(path);
+      return NULL;
+   }
+
    /* Try file in bin dir */
 
    if(Closure->binDir)