codetools: fixed TCodeToolsOptions.LoadFromFile to not expand empty settings, bug #18364

git-svn-id: trunk@29219 -
This commit is contained in:
mattias 2011-01-27 18:59:48 +00:00
parent f9121611a1
commit d5985e3606
4 changed files with 31 additions and 8 deletions

View File

@ -173,7 +173,7 @@ procedure TCodeToolsOptions.SetFPCPath(const AValue: string);
var
NewValue: String;
begin
NewValue:=ExpandFileNameUTF8(AValue);
NewValue:=TrimAndExpandFilename(AValue);
if FFPCPath=NewValue then exit;
FFPCPath:=NewValue;
FUnitLinkListValid:=false;
@ -184,7 +184,7 @@ procedure TCodeToolsOptions.SetFPCSrcDir(const AValue: string);
var
NewValue: String;
begin
NewValue:=ExpandFileNameUTF8(AValue);
NewValue:=TrimAndExpandFilename(AValue);
if FFPCSrcDir=NewValue then exit;
FFPCSrcDir:=NewValue;
FUnitLinkListValid:=false;
@ -203,7 +203,7 @@ procedure TCodeToolsOptions.SetLazarusSrcDir(const AValue: string);
var
NewValue: String;
begin
NewValue:=ExpandFileNameUTF8(AValue);
NewValue:=TrimAndExpandFilename(AValue);
if FLazarusSrcDir=NewValue then exit;
FLazarusSrcDir:=NewValue;
Modified:=true;

View File

@ -87,7 +87,7 @@ begin
writeln('TARGET=',Options.TargetOS);
writeln('TARGETCPU=',Options.TargetProcessor);
if (ParamCount>=3) then begin
Options.TestPascalFile:=ExpandFileName(ParamStr(1));
Options.TestPascalFile:=ExpandFileNameUTF8(ParamStr(1));
X:=StrToInt(ParamStr(2));
Y:=StrToInt(ParamStr(3));
end;

View File

@ -1,15 +1,17 @@
<?xml version="1.0"?>
<CONFIG>
<ProjectOptions>
<Version Value="7"/>
<Version Value="9"/>
<General>
<Flags>
<LRSInOutputDirectory Value="False"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<TargetFileExt Value=""/>
</General>
<BuildModes Count="1">
<Item1 Name="default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
@ -35,7 +37,12 @@
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="8"/>
<Version Value="10"/>
<Parsing>
<SyntaxOptions>
<UseAnsiStrings Value="False"/>
</SyntaxOptions>
</Parsing>
<Other>
<CompilerPath Value="$(CompPath)"/>
</Other>

View File

@ -36,12 +36,28 @@ var
NewCode: TCodeBuffer;
NewX, NewY, NewTopLine: integer;
RevertableJump: boolean;
X: Integer;
Y: Integer;
begin
if (ParamCount>=1) and (Paramcount<3) then begin
writeln('Usage:');
writeln(' ',ParamStr(0));
writeln(' ',ParamStr(0),' <filename> <X> <Y>');
end;
ExpandedFilename:=ExpandFileNameUTF8('scanexamples/methodjump1.pas');
X:=14;
Y:=10;
if (ParamCount>=3) then begin
ExpandedFilename:=ExpandFileNameUTF8(ParamStr(1));
X:=StrToInt(ParamStr(2));
Y:=StrToInt(ParamStr(3));
end;
CodeBuf:=CodeToolBoss.LoadFile(ExpandedFilename,true,false);
if CodeBuf=nil then
raise Exception.Create('failed loading '+ExpandedFilename);
if CodeToolBoss.JumpToMethod(CodeBuf,14,10,NewCode,NewX,NewY,NewTopLine,
if CodeToolBoss.JumpToMethod(CodeBuf,X,Y,NewCode,NewX,NewY,NewTopLine,
RevertableJump)
then
writeln(NewCode.Filename,' ',NewX,',',NewY,' TopLine=',NewTopLine,