//
// DO NOT REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
//
// @Authors:
//       timop
//
// Copyright 2004-2011 by OM International
//
// This file is part of OpenPetra.org.
//
// OpenPetra.org 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 3 of the License, or
// (at your option) any later version.
//
// OpenPetra.org 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.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with OpenPetra.org.  If not, see <http://www.gnu.org/licenses/>.
//
using NAnt.Core;
using NAnt.Core.Attributes;
using System;
using System.Diagnostics;

namespace Ict.Tools.NAntTasks
{
    /// <summary>
    /// run a dot net program. On Linux this need to call mono explicitely
    /// </summary>
    [TaskName("ExecDotNet")]
    public class ExecDotNetTask : NAnt.Core.Tasks.ExecTask
    {
        /// <summary>
        /// run the task
        /// </summary>
        protected override void ExecuteTask()
        {
            if (NAnt.Core.PlatformHelper.IsMono)
            {
                string origProgramFileName = ProgramFileName;
                this.FileName = "mono";
                this.CommandLineArguments = origProgramFileName + " " + this.CommandLineArguments;
            }
            else
            {
                // default exec
            }

            base.ExecuteTask();
        }
    }
}