mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-09 23:17:21 +01:00
MG: fixed compiling for invalid programnames
git-svn-id: trunk@1779 -
This commit is contained in:
parent
04cb1f713a
commit
a8838bdc2d
@ -105,7 +105,7 @@ begin
|
||||
ProjectDir:=ExtractFilePath(ProjectFilename);
|
||||
if not SetCurrentDir(ProjectDir) then exit;
|
||||
try
|
||||
CmdLine := AProject.CompilerOptions.CompilerPath;
|
||||
CmdLine := ConvertSpecialFileChars(AProject.CompilerOptions.CompilerPath);
|
||||
|
||||
if Assigned(FOnCmdLineCreate) then begin
|
||||
Abort:=false;
|
||||
@ -133,7 +133,7 @@ begin
|
||||
CmdLine := CmdLine+' -B';
|
||||
CmdLine := CmdLine
|
||||
+ ' '+ AProject.CompilerOptions.MakeOptionsString(ProjectFilename)
|
||||
+ ' '+ ProjectFilename;
|
||||
+ ' '+ PrepareCmdLineOption(ProjectFilename);
|
||||
if Assigned(FOnCmdLineCreate) then begin
|
||||
Abort:=false;
|
||||
FOnCmdLineCreate(CmdLine,Abort);
|
||||
@ -189,6 +189,9 @@ end.
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.31 2002/07/05 10:53:25 lazarus
|
||||
MG: fixed compiling for invalid programnames
|
||||
|
||||
Revision 1.30 2002/05/10 06:57:38 lazarus
|
||||
MG: updated licenses
|
||||
|
||||
|
||||
@ -55,6 +55,8 @@ function SearchFileInPath(const Filename, BasePath, SearchPath,
|
||||
Delimiter: string): string;
|
||||
procedure SplitCmdLine(const CmdLine: string;
|
||||
var ProgramFilename, Params: string);
|
||||
function ConvertSpecialFileChars(const Filename: string): string;
|
||||
function PrepareCmdLineOption(const Option: string): string;
|
||||
|
||||
// XMLConfig
|
||||
procedure LoadRecentList(XMLConfig: TXMLConfig; List: TStringList;
|
||||
@ -695,4 +697,49 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
{-------------------------------------------------------------------------------
|
||||
ConvertSpecialFileChars
|
||||
|
||||
Params: const Filename: string
|
||||
Result: string
|
||||
|
||||
Replaces all spaces in a filename.
|
||||
-------------------------------------------------------------------------------}
|
||||
function ConvertSpecialFileChars(const Filename: string): string;
|
||||
const
|
||||
SpecialChar = '\';
|
||||
var i: integer;
|
||||
begin
|
||||
Result:=Filename;
|
||||
i:=1;
|
||||
while (i<=length(Result)) do begin
|
||||
if Result[i]<>' ' then begin
|
||||
inc(i);
|
||||
end else begin
|
||||
Result:=LeftStr(Result,i-1)+SpecialChar+RightStr(Result,length(Result)-i+1);
|
||||
inc(i,2);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
{-------------------------------------------------------------------------------
|
||||
PrepareCmdLineOption
|
||||
|
||||
Params: const Option: string
|
||||
Result: string
|
||||
|
||||
If there is a space in the option add " "
|
||||
-------------------------------------------------------------------------------}
|
||||
function PrepareCmdLineOption(const Option: string): string;
|
||||
var i: integer;
|
||||
begin
|
||||
Result:=Option;
|
||||
for i:=1 to length(Result) do begin
|
||||
if Result[i]=' ' then begin
|
||||
Result:='"'+Result+'"';
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user