//-----------------------------------------------------------------------------
// Torque2D Packaging Utility
// Copyright (C) GarageGames.com, Inc.
//-----------------------------------------------------------------------------

function initializePackagingUtility()
{
   echo( "\n--------- Initializing Packaging Utility ---------" );
   
   exec( "./packagingPrefs.ed.cs" );
   exec( "./packagingUtility.ed.cs" );
   exec( "./htmlReport.ed.cs" );
   exec( "./guiReport.ed.cs" );
   exec( "./fileRefList.ed.cs" );
   exec( "./fileRefObject.ed.cs" );
   exec( "./loadSave.ed.cs" );
   exec( "./ui/packagingUtilityDlg.ed.gui" );
   exec( "./ui/packagingOptionsDlg.ed.gui" );
   exec( "./ui/packagingStatusDlg.ed.gui"  );
   exec( "./ui/packagingExtensionsDlg.ed.gui" );
   
   echo( "\n--------- Loading Script Handlers ---------" );
   %fileSpec = expandFilename( "tools/packagingUtility/" ) @ "*.cs" SPC expandFilename( "tools/packagingUtility/" ) @ "*.edso";
   for (%file = findFirstFileMultiExpr(%fileSpec); %file !$= ""; %file = findNextfileMultiExpr(%fileSpec))
   {      
      if( !isFile( %file ) )
         continue;

      %loc = strstr( fileBase( %file ), "_Handler" );
      if( %loc == -1 )
         continue;
         
      %dsoCheck = strstr( %file, ".edso" );
      if( %dsoCheck != -1 )
      {
         %csOriginal = strreplace( %file, ".edso", "" );
         if( !isFile( %csOriginal ) )
            exec( %csOriginal );
      }
      else
         exec( %file );
   }

   //GlobalActionMap.bindCmd(keyboard, "f6", "togglePackagingUtility();", "");
  
}

function destroyPackagingUtility()
{
}
