#!/usr/bin/perl -w
# Location specific setup
# vim:set sts=4 sw=4:
use File::Basename;
use File::Spec;
use Carp;

sub simpl_path($);

my $path = simpl_path(dirname($0)."/..");

my $ttf = simpl_path("$path/fonts/truetype/");
my $upref = simpl_path("$path/mozilla-1.1/defaults/pref/unix.js");

open(Config,"+<$upref") or
    		 die "Mozilla configuration file not found in $upref";
my @data = ();
while (<Config>) {
    $_ = "pref(\"font.directory.truetype.1\", \"$ttf\");\n"
    				    if /font\.directory\.truetype\.1/;
    push(@data,$_);
}
close(Config);

open(Config,">$upref") or
	    die "Could not open Mozilla configuration file $upref for writing";
foreach $_ (@data) {
    print Config $_;
}
close(Config);

sub simpl_path($)
{
    return File::Spec->canonpath(File::Spec->rel2abs(shift));
}
