#
# TWiki Collaboration Platform, http://TWiki.org/
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version. For
# more details read LICENSE in the root of this distribution.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# setlib.cfg: determines the defaults for TWiki and Perl library paths
#

###########################################################################
# DO NOT CHANGE THIS FILE - instead, create a file called LocalLib.cfg    #
# using the LocalLib.cfg.txt template file and customise your settings in #
# there. They will override any settings in this file.                    #
###########################################################################

use vars qw( $twikiLibPath @localPerlLibPath );

eval 'require "LocalLib.cfg"';

unless (( defined ($twikiLibPath) ) and (-e $twikiLibPath)) {
	use Cwd qw( abs_path );
	( $twikiLibPath ) = ($twikiLibPath = Cwd::abs_path( "../lib" )) =~ /(.*)/;
}
if ($twikiLibPath eq "") {
    $twikiLibPath = "../lib";
    warn "using relative path for libs - some plugins may break";
}

#    Path to local Perl modules
$CPANBASE = "$twikiLibPath/CPAN/lib/" unless $CPANBASE;
if ( -e $CPANBASE ) {
	require Config;
	my $VER = $Config::Config{version};
	my $SITEARCH = $Config::Config{archname};
	push @localPerlLibPath, ( "$CPANBASE/arch/", "$CPANBASE/$VER/$SITEARCH/", "$CPANBASE/$VER/", "$CPANBASE/" );
}

# Prepend to @INC, the Perl search path for modules
unshift @INC, $twikiLibPath;
unshift @INC, @localPerlLibPath if defined @localPerlLibPath;

1;			    	# Return success for module loading

