Changeset 5 for trunk/UInstance.pas


Ignore:
Timestamp:
Feb 3, 2011, 2:18:11 PM (13 years ago)
Author:
chronos
Message:
 
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svn:ignore
      •  

        old new  
        11lib
        22FreePascalManager.exe
        3 SourceList.xml
        43Config.xml
         4Source
         5Instance
  • trunk/UInstance.pas

    r4 r5  
    66
    77uses
    8   Classes, SysUtils, USource, Contnrs;
     8  Classes, SysUtils, USource, Contnrs, Process, Forms, Controls,
     9  FileUtil;
    910
    1011type
     
    1213
    1314  TInstance = class
     15  private
     16    function GetDownloaded: Boolean;
     17  public
    1418    Id: Integer;
    1519    Name: string;
    16     Downloaded: Boolean;
    1720    Compiled: Boolean;
    1821    IDESource: TSource;
     
    2427    procedure Build;
    2528    procedure Start;
    26     procedure Update;
    27     procedure Download;
     29    function GetPath: string;
     30    property Downloaded: Boolean read GetDownloaded;
    2831  end;
    2932
     
    3538
    3639implementation
     40
     41uses
     42  UOperationProgress, UMainForm;
    3743
    3844{ TInstanceList }
     
    5056{ TInstance }
    5157
     58function TInstance.GetDownloaded: Boolean;
     59begin
     60  Result := DirectoryExistsUTF8(GetPath + DirectorySeparator + FPCSource.ProjectShortName);
     61  if Assigned(IDESource) then Result := Result and
     62    DirectoryExistsUTF8(GetPath + DirectorySeparator + IDESource.ProjectShortName);
     63end;
     64
    5265procedure TInstance.Build;
    5366begin
     67  OperationProgressForm.Environment := 'path=' + //GetEnvironmentVariable('PATH') + ';' +
     68    MainForm.GetBinUtilsDir;
     69  OperationProgressForm.Path := GetPath + DirectorySeparator + FPCSource.ProjectShortName;
     70  OperationProgressForm.CommandLine :=
     71    '"' + MainForm.GetBinUtilsDir + DirectorySeparator + 'make.exe" clean all PP="' +
     72    MainForm.GetBinUtilsDir + '"';
     73  OperationProgressForm.ShowModal;
    5474
     75  OperationProgressForm.Path := GetPath + DirectorySeparator + FPCSource.ProjectShortName;
     76  OperationProgressForm.CommandLine :=
     77    '"' + MainForm.GetBinUtilsDir + DirectorySeparator + 'make.exe" install PREFIX="' +
     78    GetPath + DirectorySeparator + FPCSource.ProjectShortName + '"' +
     79    ' PP="' + MainForm.GetBinUtilsDir + '"';
     80  OperationProgressForm.ShowModal;
     81
     82  if Assigned(IDESource) then begin
     83    OperationProgressForm.Path := GetPath + DirectorySeparator + IDESource.ProjectShortName;
     84    OperationProgressForm.CommandLine :=
     85      '"' + MainForm.GetBinUtilsDir + DirectorySeparator + 'make.exe" bigideclean bigide OPT="-Xg"';
     86    OperationProgressForm.ShowModal;
     87  end;
    5588end;
    5689
    5790procedure TInstance.Start;
     91var
     92  Process: TProcess;
    5893begin
    59 
     94  if Assigned(IDESource) then
     95  try
     96    Process := TProcess.Create(nil);
     97    Process.CurrentDirectory := GetPath + DirectorySeparator + IDESource.ProjectShortName;
     98    Process.CommandLine := IDESource.GetExecutableFile;
     99    Process.Execute;
     100  finally
     101    Process.Free;
     102  end;
    60103end;
    61104
    62 procedure TInstance.Update;
     105function TInstance.GetPath: string;
    63106begin
    64 
    65 end;
    66 
    67 procedure TInstance.Download;
    68 begin
    69 
     107  Result := ExtractFileDir(Application.ExeName) + DirectorySeparator +
     108    MainForm.InstanceDir + DirectorySeparator + IntToStr(Id);
    70109end;
    71110
Note: See TracChangeset for help on using the changeset viewer.