$FileConfig=$FileSuffix='';
foreach my $dir (@PossibleConfigDir) {
my $searchdir=$dir;
- if ($searchdir && (!($searchdir =~ /\/$/)) && (!($searchdir =~ /\\$/)) ) { $searchdir .= "/"; }
+ if ($searchdir && $searchdir !~ /[\\\/]$/) { $searchdir .= "/"; }
if (open(CONFIG,"$searchdir$PROG.$SiteConfig.conf")) { $FileConfig="$searchdir$PROG.$SiteConfig.conf"; $FileSuffix=".$SiteConfig"; last; }
if (open(CONFIG,"$searchdir$PROG.conf")) { $FileConfig="$searchdir$PROG.conf"; $FileSuffix=''; last; }
}
if ($_ =~ /^#include "([^\"]+)"/) {
my $includeFile = $1;
if ($Debug) { debug("Found an include : $includeFile",2); }
- # Correct relative include files
- if ( $includeFile !~ m|^[\\/]| ) {
- my $configDir = $FileConfig;
- if ($configDir =~ s|[\\/][^\\/]*$|/|) { $includeFile = "$configDir$includeFile"; }
- else { $includeFile = "$includeFile"; }
+ if ( $includeFile !~ /^[\\\/]/ ) {
+ # Correct relative include files
+ if ($FileConfig =~ /^(.*[\\\/])[^\\\/]*$/) { $includeFile = "$1$includeFile"; }
}
if ( open( CONFIG_INCLUDE, $includeFile ) ) {
&Parse_Config( *CONFIG_INCLUDE , $level+1, $includeFile);