File rarian-help-bundle.patch of Package rarian

diff -aurp rarian-0.7.1/librarian/rarian-omf.cpp rarian-0.7.1-patched/librarian/rarian-omf.cpp
--- rarian-0.7.1/librarian/rarian-omf.cpp	2008-01-07 23:21:51.000000000 +0100
+++ rarian-0.7.1-patched/librarian/rarian-omf.cpp	2008-05-07 13:31:07.910658000 +0200
@@ -186,6 +186,33 @@ rrn_omf_parse_file (char *path)
       return NULL;
     }
 
+    if (reg->uri && strncmp (reg->uri, "file://", strlen ("file://")) == 0) {
+      char *path;
+      path = reg->uri + strlen ("file://");
+      if (access (path, R_OK) != 0) {
+        if (strncmp (path, "/usr/share/gnome/help/", strlen ("/usr/share/gnome/help/")) == 0) {
+          char *new_uri;
+
+          new_uri = (char *) malloc (sizeof(char) * (strlen (reg->uri) + strlen ("-bundle") + 1));
+          sprintf (new_uri, "file:///usr/share/gnome/help-bundle/%s", path + strlen ("/usr/share/gnome/help/"));
+          free (reg->uri);
+          reg->uri = NULL;
+          path = new_uri + strlen ("file://");
+
+          if (access (path, R_OK) == 0) {
+            reg->uri = new_uri;
+          } else {
+            free (new_uri);
+          }
+        }
+      }
+    }
+
+    if (!reg->uri) {
+      rrn_reg_free (reg);
+      return NULL;
+    }
+
     if (!reg->identifier) {
       reg->identifier = (char *) malloc (sizeof(char) * 35);
       sprintf (reg->identifier, "org.scrollkeeper.unknown%d", rand());
openSUSE Build Service is sponsored by