#!/usr/bin/perl
use strict;
use warnings;

use File::Glob;
use File::Copy;
use File::Path;
use Cwd;
use File::Basename;
use lib ( dirname($0) );
use Qtopia::Paths;
use Qtopia::Vars;
use Qtopia::File;

Qtopia::Paths::get_paths();

# Windows depot builds use the perl scripts directly rather than the compiled code
if ( $isWindows ) {
    check_script($0, "$depotpath/bin", $ARGV[0]);
}

my $assistant;
if ( -f "$HOST_QT_BINS/assistant_adp" ) {
    $assistant = "$HOST_QT_BINS/assistant_adp";
} else {
    $assistant = "$HOST_QT_BINS/assistant";
}

# Load the Qtopia content files
for my $file ( "$SDKROOT/doc/html/qtopia.dcf",
               "$SDKROOT/doc/html/qbuild/qbuild.dcf",
               "$SDKROOT/doc/html/buildsystem/buildsystem.dcf",
               "$SDKROOT/doc/html/qtopiadesktop/qtopiadesktop.dcf" ) {
    if ( -f $file ) {
        system($assistant, "-addContentFile", $file);
    }
}

my @cmd = ($assistant, @ARGV);
if ( $isWindows ) {
    unshift(@cmd, "start", "/b");
}
my $ret = system(@cmd);
$ret = $ret >> 8;
exit $ret;

