$dir = $0;

$dir =~ s/\\/\//g;
if($dir =~ /\//)
{
	$dir =~ s/^(.*)\/(.*?)$/$1/;
}
else
{
	$dir = cwd();
}


my $file = "$dir/config.dat";
my %conf;
open(FILE, "$file") or die "ERROR: config.pl couldnt open \"$file\"\n";
my @tmp = <FILE>;
close(FILE);

for(@tmp)
{
	chomp;                  # no newline
	s/#.*//;                # no comments
	s/^\s+//;               # no leading white
	s/\s+$//;               # no trailing white
	next unless length;     # anything left?
	$var = $_;
	$value = $_;
	$var =~ s/^(.*?)\s*\t*\s*=\s*.*$/$1/e;
	$value =~ s/(.*?)\s*\t*\s*=\s*(.*)$/$2/e;
	$conf{$var} = $value;		
}

# setup vars read from config.dat 

$theme 		= $conf{'theme'};
$enc_opts 		= $conf{'enc_opts'};
$duration 		= $conf{'duration'};
$flvtool_exe 	= $conf{'flvtool_exe'};
$use_flvtool	= $conf{'use_flvtool'};
$enc_exe 		= $conf{'enc_exe'};
$drive_list		= $conf{'drive_list'};
$xampp_dir		= $conf{'xampp_dir'};
$perl_exe		= $conf{'perl_exe'};
$sys_shell		= $conf{'sys_shell'};

#####################
# Advanced settings #
#####################

# shoud not need to change these settings, unless you are hacking/ customizing WiiCR

# ------------
# local dirs 

$wiicr_local_dir	= "$xampp_dir/htdocs/wiicr";
$tools_local_dir	= "$xampp_dir/wiicr_tools";

$theme_local_dir 	= "$wiicr_local_dir/themes/$theme";
$tpl_local_dir		= "$theme_local_dir/tpl";
$cgi_local_dir		= "$wiicr_local_dir";
$flv_local_dir 		= "$wiicr_local_dir/flv";
$work_dir 		= "$wiicr_local_dir/work";

# -----------
# http dirs

$wiicr_dir		= "/wiicr";
$cgi_dir		= "$wiicr_dir";
$images_dir		= "$wiicr_dir/images";
$theme_dir 		= "$wiicr_dir/themes/$theme";
$tpl_dir		= "$theme_dir/tpl";
$flv_dir 		= "$wiicr_dir/flv";

# -------
# Files

$links 			= "$theme_local_dir/links.txt";
$favourites		= "$wiicr_local_dir/favs.txt";
$mp3_pls 		= "$wiicr_local_dir/mylistdata.xml";
$mp3_txt		= "$wiicr_local_dir/mp3s.txt";

############################
# End of Advanced settings #
############################

sub read_config
{
}


1;
