summaryrefslogtreecommitdiffstats
path: root/khelpcenter/searchhandlers/khc_beagle_index.pl
diff options
context:
space:
mode:
Diffstat (limited to 'khelpcenter/searchhandlers/khc_beagle_index.pl')
-rw-r--r--khelpcenter/searchhandlers/khc_beagle_index.pl49
1 files changed, 49 insertions, 0 deletions
diff --git a/khelpcenter/searchhandlers/khc_beagle_index.pl b/khelpcenter/searchhandlers/khc_beagle_index.pl
new file mode 100644
index 000000000..02f1b9330
--- /dev/null
+++ b/khelpcenter/searchhandlers/khc_beagle_index.pl
@@ -0,0 +1,49 @@
+#!/usr/bin/perl
+# vim:sw=4:et
+
+use warnings;
+
+sub getKDEDocDir()
+{
+ my $prefix = `kde-config --prefix`;
+ chomp $prefix;
+
+ $prefix = "/opt/kde" if (not defined($prefix));
+ return "$prefix/share/doc";
+}
+
+sub addRoot()
+{
+ my $kdedocdir = &getKDEDocDir;
+
+ open (IN, "-|") || exec "beagle-config", "indexing", "ListRoots";
+
+ my $kdedoc_found = 0;
+ while(<IN>) {
+ if (/^$kdedocdir/o) {
+ $kdedoc_found = 1;
+ last;
+ }
+ }
+ close(IN);
+
+ if (not $kdedoc_found) {
+ `beagle-config indexing AddRoot $kdedocdir`;
+ `beagle-config indexing AddRoot $kdedocdir-bundle`;
+ }
+}
+
+sub createExistsFile($$)
+{
+ my ($idir, $ident) = @_;
+
+ open(OUT, ">", "$idir/$idir");
+ close(OUT);
+}
+
+my $idir = $ARGV[0];
+my $ident = $ARGV[1];
+
+if (addRoot) {
+ createExistsFile($idir, $ident);
+}