Ignore:
Timestamp:
Feb 13, 2012, 12:26:12 PM (13 years ago)
Author:
chronos
Message:
  • Fixed: Compile and run C project using MinGW gcc.
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svn:ignore
      •  

        old new  
        44backup
        55LazFuckIDE
         6compiled
  • trunk/Forms/UMainForm.pas

    r27 r28  
    166166  SNumberGeneration = 'Number generation';
    167167  SProgramExited = 'Program exited';
    168   SCompilerNotFound = 'Compiler "%s" not found';
    169   SCompiledFileNotFound = 'Program compiled file "%s" not found';
    170168
    171169{ TMainForm }
     
    459457
    460458procedure TMainForm.ACompileAndRunExecute(Sender: TObject);
    461 var
    462   Process: TProcess;
    463   CompiledFile: string;
    464459begin
    465460  with TBrainFuckCompiler(Compilers[CompilerIndex]) do begin
     
    467462    Source := MemoSource.Text;
    468463    ProgramName := ExtractFileNameOnly(ProjectFileName);
     464    ProjectFileName := Self.ProjectFileName;
    469465    Compile;
    470     CompiledFile := ExtractFilePath(ProjectFileName) +
    471       'compiled' + DirectorySeparator + Name + DirectorySeparator +
    472       ExtractFileNameOnly(ProjectFileName) + SourceExtension;
    473     ForceDirectoriesUTF8(ExtractFilePath(CompiledFile));
    474     with TStringList.Create do
    475     try
    476       Text := Output;
    477       SaveToFile(CompiledFile);
    478     finally
    479       Free;
    480     end;
    481     if FileExistsUTF8(CompilerPath) then
    482     try
    483       Process := TProcess.Create(nil);
    484       Process.CommandLine := '"' + CompilerPath + '" "' + CompiledFile + '"';
    485       Process.Options := [poWaitOnExit];
    486       Process.Execute;
    487     finally
    488       Process.Free;
    489     end else raise Exception.Create(Format(SCompilerNotFound, [CompilerPath]));
    490 
    491     if CompiledExtension <> '' then begin
    492       CompiledFile := ExtractFilePath(CompiledFile) + ExtractFileNameOnly(CompiledFile) + CompiledExtension;
    493       if FileExistsUTF8(CompiledFile) then
    494       try
    495         Process := TProcess.Create(nil);
    496         Process.CommandLine := '"' + CompiledFile + '"';
    497         Process.Options := [poWaitOnExit];
    498         Process.Execute;
    499       finally
    500         Process.Free;
    501       end else raise Exception.Create(Format(SCompiledFileNotFound, [CompiledFile]));
    502     end;
     466    CompileToFile;
     467    if CompiledExtension <> '' then Run;
    503468  end;
    504469end;
Note: See TracChangeset for help on using the changeset viewer.