Changeset 60 for trunk/Target/UTarget.pas
- Timestamp:
- Dec 3, 2014, 10:45:24 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Target/UTarget.pas
r58 r60 69 69 cmOutput, cmInput, cmLoopStart, cmLoopEnd, cmDebug); 70 70 71 TLogEvent = procedure (Lines: TStrings) of object; 72 71 73 { TTarget } 72 74 73 75 TTarget = class 76 private 77 FOnLog: TLogEvent; 74 78 protected 75 79 FCompiled: Boolean; … … 101 105 ExecutorPath: string; 102 106 SourceExtension: string; 107 RunExtension: string; 103 108 CompiledExtension: string; 104 109 ProjectFileName: string; … … 124 129 procedure SaveToRegistry(Root: HKEY; Key: string); virtual; 125 130 property State: TRunState read FState write SetState; 126 property OnChangeState: TNotifyEvent read FOnChangeState write FOnChangeState;127 131 property SourceCode: string write SetSourceCode; 128 132 property TargetCode: string read GetTargetCode; … … 130 134 property ExecutionPosition: Integer read GetExecutionPosition; 131 135 property ProgramIndex: Integer read FProgramIndex; 136 property OnChangeState: TNotifyEvent read FOnChangeState write FOnChangeState; 137 property OnLog: TLogEvent read FOnLog write FOnLog; 132 138 end; 133 139 … … 396 402 Process: TProcess; 397 403 CompiledFile: string; 404 Lines: TStringList; 405 I: Integer; 398 406 begin 399 407 CompiledFile := ExtractFilePath(ProjectFileName) + … … 412 420 try 413 421 Process := TProcess.Create(nil); 414 Process.CurrentDirectory := ExtractFilePath(CompilerPath); 415 Process.CommandLine := LongFileName(CompilerPath) + ' ' + LongFileName(CompiledFile); 416 Process.Options := [poWaitOnExit]; 422 Process.CurrentDirectory := ExtractFilePath(CompiledFile); 423 Process.Executable := LongFileName(CompilerPath); 424 Process.Parameters.Add(LongFileName(CompiledFile)); 425 for I := 0 to GetEnvironmentVariableCount - 1 do 426 Process.Environment.Add(GetEnvironmentString(I)); 427 Process.Options := [poWaitOnExit, poUsePipes]; 417 428 Process.Execute; 429 if Assigned(FOnLog) then begin 430 Lines := TStringList.Create; 431 Lines.LoadFromStream(Process.Output); 432 Lines.Insert(0, Process.Executable + ' ' + Process.Parameters.Text); 433 FOnLog(Lines); 434 Lines.Free; 435 end; 418 436 finally 419 437 Process.Free; … … 426 444 Process: TProcess; 427 445 CompiledFile: string; 446 RunFile: string; 428 447 begin 429 448 CompiledFile := ExtractFilePath(ProjectFileName) + 430 449 'compiled' + DirectorySeparator + Name + DirectorySeparator + 431 450 ExtractFileNameOnly(ProjectFileName) + CompiledExtension; 451 RunFile := ExtractFilePath(ProjectFileName) + 452 'compiled' + DirectorySeparator + Name + DirectorySeparator + 453 ExtractFileNameOnly(ProjectFileName) + RunExtension; 432 454 if FileExistsUTF8(CompiledFile) then 433 455 try 434 456 Process := TProcess.Create(nil); 435 if ExecutorPath <> '' then Process.CommandLine := LongFileName(ExecutorPath) + ' '; 436 Process.CommandLine := Process.CommandLine + LongFileName(CompiledFile); 437 Process.Options := [poWaitOnExit]; 457 if ExecutorPath <> '' then begin 458 Process.Executable := LongFileName(ExecutorPath); 459 Process.Parameters.Add(LongFileName(RunFile)); 460 end else Process.Executable := LongFileName(RunFile); 461 Process.ShowWindow := swoShow; 462 Process.Options := [poWaitOnExit, poNewConsole]; 438 463 Process.Execute; 439 464 finally
Note:
See TracChangeset
for help on using the changeset viewer.