【发布时间】:2009-12-29 00:52:12
【问题描述】:
我有一个关于 Lazarus 的项目,我想使用 gcc 编译源代码,为此我有一个名为 OpenDialog1 的 TOpenDialog 和一个名为 AProcess 的 TProcess。
我用这段代码调用 gcc:
procedure TFormMain.btCompileClick(Sender: TObject);
begin
if OpenDialog1.Execute then
begin
AProcess := TProcess.Create(nil);
try
AProcess.CommandLine := 'gcc.exe ' + OpenDialog1.FileName;
AProcess.Options := AProcess.Options + [poWaitOnExit, poUsePipes];
AProcess.Execute;
OutputMemo.Lines.BeginUpdate;
OutputMemo.Lines.Clear;
OutputMemo.Lines.LoadFromStream(AProcess.Output);
OutputMemo.Lines.EndUpdate;
finally
AProcess.Free;
end;
end;
end;
它可以编译(Lazzarus 上的项目),但是当我测试它时,通过尝试编译位于 C:\Documents and Settings\Nathan Campos\Desktop 的源 test.c,我在 OutputMemo 上得到了这个:
'C:\Documents': 没有这样的文件或目录
那么,OpenDialog1 没有得到带空格的完整路径,或者 gcc 无法在带空格的文件夹中找到它。
有什么建议可以帮助我吗?
【问题讨论】:
标签: delphi directory spaces lazarus