[Lxr-commits] CVS: lxr/lib/LXR Config.pm,1.33,1.34
Brought to you by:
ajlittoz
From: AdrianIssott <adr...@us...> - 2009-04-08 21:17:13
|
Update of /cvsroot/lxr/lxr/lib/LXR In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv5798/lib/LXR Modified Files: Config.pm Log Message: Fix for bug 2745362 (LXR::Config Is Too Strict) - LXR::Config now creates the tmpdir, glimpsedir and swishdirs as necessary when it is initialised. Index: Config.pm =================================================================== RCS file: /cvsroot/lxr/lxr/lib/LXR/Config.pm,v retrieving revision 1.33 retrieving revision 1.34 diff -u -d -r1.33 -r1.34 --- Config.pm 10 Sep 2005 00:09:20 -0000 1.33 +++ Config.pm 8 Apr 2009 21:17:06 -0000 1.34 @@ -21,6 +21,7 @@ $CVSID = '$Id$ '; use strict; +use File::Path; use LXR::Common; @@ -116,6 +117,23 @@ "the --url parameter should be a URL (e.g. http://example.com/lxr) and must match a baseurl line in lxr.conf\n"; } } + + # Set-up various directories as necessary + _ensuredirexists($self->{tmpdir}); + + if (exists $self->{glimpsebin} and exists $self->{swishbin}) { + die "Both Glimpse and Swish have been specified in $confpath.\n". + "Please choose one or other of them by commenting out either glimpsebin or swishbin.\n"; + } elsif (exists $self->{glimpsebin}) { + die "Please specifiy glimpsedir in $confpath\n" if !exists $self->{glimpsedir}; + _ensuredirexists($self->{glimpsedir}); + } elsif (exists $self->{swishbin}) { + die "Please specifiy glimpsedir in $confpath\n" if !exists $self->{swishdir}; + _ensuredirexists($self->{swishdir}); + } else { + die "Neither Glimpse nor Swish have been specified in $confpath.\n". + "Please choose one or other of them by specifing a value for either glimpsebin or swishbin.\n"; + } } sub allvariables { @@ -218,4 +236,12 @@ return $path; } +sub _ensuredirexists { + my $dir = shift; + if(!-d $dir) { + mkpath($dir) or die "Couldn't make the directory $dir: ?!"; + } +} + + 1; |