sourcepawn/batchtool/compile.dpr
branchsourcemod-1.1.0
changeset 2283 03a67e41afbc
parent 1951 c7b4237fff50
child 2287 017a725c9d17
     1.1 --- a/sourcepawn/batchtool/compile.dpr	Fri Mar 28 06:21:34 2008 +0000
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,101 +0,0 @@
     1.4 -(* SourceMod
     1.5 -*    compile.exe
     1.6 -*
     1.7 -* by the SourceMod Development Team (adapted from AMX Mod X's compiler tool)
     1.8 -*
     1.9 -*
    1.10 -*  This program is free software; you can redistribute it and/or modify it
    1.11 -*  under the terms of the GNU General Public License as published by the
    1.12 -*  Free Software Foundation; either version 2 of the License, or (at
    1.13 -*  your option) any later version.
    1.14 -*
    1.15 -*  This program is distributed in the hope that it will be useful, but
    1.16 -*  WITHOUT ANY WARRANTY; without even the implied warranty of
    1.17 -*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    1.18 -*  General Public License for more details.
    1.19 -*
    1.20 -*  You should have received a copy of the GNU General Public License
    1.21 -*  along with this program; if not, write to the Free Software Foundation,
    1.22 -*  Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
    1.23 -*
    1.24 -*  In addition, as a special exception, the author gives permission to
    1.25 -*  link the code of this program with the Half-Life Game Engine ("HL
    1.26 -*  Engine") and Modified Game Libraries ("MODs") developed by Valve,
    1.27 -*  L.L.C ("Valve"). You must obey the GNU General Public License in all
    1.28 -*  respects for all of the code used other than the HL Engine and MODs
    1.29 -*  from Valve. If you modify this file, you may extend this exception
    1.30 -*  to your version of the file, but you are not obligated to do so. If
    1.31 -*  you do not wish to do so, delete this exception statement from your
    1.32 -*  version.
    1.33 -*)
    1.34 -
    1.35 -program compile;
    1.36 -
    1.37 -{$APPTYPE CONSOLE}
    1.38 -{$R version.res}
    1.39 -{$R icon.res}
    1.40 -
    1.41 -uses
    1.42 -  SysUtils, Classes, IniFiles,
    1.43 -  uFunc in 'uFunc.pas';
    1.44 -
    1.45 -var sr: TSearchRec;
    1.46 -    i: Word;
    1.47 -    cfg: TIniFile;
    1.48 -    outdir: String;
    1.49 -begin
    1.50 -  WriteLn('//SourceMod Batch Compiler');
    1.51 -  WriteLn('// by the SourceMod Dev Team');
    1.52 -  WriteLn;
    1.53 -
    1.54 -  if not FileExists(ExtractFilePath(ParamStr(0))+COMPILER_EXE) then
    1.55 -  begin
    1.56 -    WriteLn('// Could not find '+COMPILER_EXE);
    1.57 -    AppExit;
    1.58 -  end;
    1.59 -
    1.60 -  cfg := TIniFile.Create(ExtractFilePath(ParamStr(0)) + 'compiler.ini');
    1.61 -  outdir := cfg.ReadString('Main', 'Output', '');
    1.62 -  if (outdir <> '') then begin
    1.63 -    if (DirectoryExists(outdir)) then
    1.64 -      outdir := IncludeTrailingPathDelimiter(outdir)
    1.65 -    else if (DirectoryExists(ExtractFilePath(ParamStr(0)) + outdir)) then
    1.66 -      outdir := ExtractFilePath(ParamStr(0)) + IncludeTrailingPathDelimiter(outdir);
    1.67 -  end
    1.68 -  else
    1.69 -    outdir := '';
    1.70 -  cfg.Free;
    1.71 -
    1.72 -  if (outdir = '') and (not DirectoryExists(ExtractFilePath(ParamStr(0))+'compiled')) then
    1.73 -    CreateDir(ExtractFilePath(ParamStr(0))+'compiled');
    1.74 -
    1.75 -  if ( ParamCount > 0 ) then
    1.76 -  begin
    1.77 -    for i := 1 to ParamCount do
    1.78 -    begin
    1.79 -      if FileExists(ParamStr(i)) then
    1.80 -        CompilePlugin(ParamStr(i), outdir)
    1.81 -      else
    1.82 -      begin
    1.83 -        WriteLn;
    1.84 -        WriteLn('// File not found.');
    1.85 -      end;
    1.86 -    end;
    1.87 -  end
    1.88 -  else
    1.89 -  begin
    1.90 -    if ( FindFirst('*.sp',faAnyFile,sr) = 0 ) then
    1.91 -    begin
    1.92 -      repeat
    1.93 -        CompilePlugin(sr.Name, outdir);
    1.94 -      until ( FindNext(sr) <> 0 );
    1.95 -    end
    1.96 -    else
    1.97 -    begin
    1.98 -      WriteLn('// No file found.');
    1.99 -    end;
   1.100 -    FindClose(sr);
   1.101 -  end;
   1.102 -
   1.103 -  AppExit;
   1.104 -end.