mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-17 21:09:27 +02:00
IDE: TrimSearchPath deleting doubles
git-svn-id: trunk@28650 -
This commit is contained in:
parent
e558b5e009
commit
777e1a450c
@ -948,7 +948,7 @@ var
|
||||
IgnoreAll: Boolean;
|
||||
begin
|
||||
Result:=mrOk;
|
||||
UnitPath:=TrimSearchPath(TheUnitPath,BaseDir);
|
||||
UnitPath:=TrimSearchPath(TheUnitPath,BaseDir,true);
|
||||
|
||||
SourceUnitTree:=TAVLTree.Create(TListSortCompare(@CompareUnitFiles));
|
||||
CompiledUnitTree:=TAVLTree.Create(TListSortCompare(@CompareUnitFiles));
|
||||
|
@ -1876,7 +1876,7 @@ procedure TfrmCompilerOptions.PathEditBtnExecuted(Sender: TObject);
|
||||
BaseDir: String;
|
||||
begin
|
||||
BaseDir:=CompilerOpts.BaseDirectory;
|
||||
ExpandedPath:=TrimSearchPath(NewPath,BaseDir);
|
||||
ExpandedPath:=TrimSearchPath(NewPath,BaseDir,true);
|
||||
Result:=CheckSearchPath(Context,ExpandedPath,ccomlHints);
|
||||
end;
|
||||
|
||||
|
@ -1678,9 +1678,12 @@ begin
|
||||
end;
|
||||
|
||||
procedure TEnvironmentOptions.SetDebuggerSearchPath(const AValue: string);
|
||||
var
|
||||
NewValue: String;
|
||||
begin
|
||||
if FDebuggerSearchPath=AValue then exit;
|
||||
FDebuggerSearchPath:=TrimSearchPath(AValue,'');
|
||||
NewValue:=TrimSearchPath(AValue,'');
|
||||
if FDebuggerSearchPath=NewValue then exit;
|
||||
FDebuggerSearchPath:=NewValue;
|
||||
end;
|
||||
|
||||
procedure TEnvironmentOptions.SetMakeFilename(const AValue: string);
|
||||
|
@ -464,7 +464,7 @@ procedure TCompilerPathOptionsFrame.PathEditBtnExecuted(Sender: TObject);
|
||||
BaseDir: string;
|
||||
begin
|
||||
BaseDir := FCompilerOpts.BaseDirectory;
|
||||
ExpandedPath := TrimSearchPath(NewPath, BaseDir);
|
||||
ExpandedPath := TrimSearchPath(NewPath, BaseDir, true);
|
||||
Result := CheckSearchPath(Context, ExpandedPath, ccomlHints);
|
||||
end;
|
||||
|
||||
|
@ -135,7 +135,8 @@ function FindFPCTool(const Executable, CompilerFilename: string): string;
|
||||
procedure ResolveLinksInFileList(List: TStrings; RemoveDanglingLinks: Boolean);
|
||||
|
||||
// search paths
|
||||
function TrimSearchPath(const SearchPath, BaseDirectory: string): string;
|
||||
function TrimSearchPath(const SearchPath, BaseDirectory: string;
|
||||
DeleteDoubles: boolean = false): string;
|
||||
function MergeSearchPaths(const OldSearchPath, AddSearchPath: string): string;
|
||||
procedure MergeSearchPaths(SearchPath: TStrings; const AddSearchPath: string);
|
||||
function RemoveSearchPaths(const SearchPath, RemoveSearchPath: string): string;
|
||||
@ -1345,7 +1346,8 @@ end;
|
||||
- If BaseDirectory<>'' then every relative Filename will be expanded.
|
||||
- removes doubles
|
||||
-------------------------------------------------------------------------------}
|
||||
function TrimSearchPath(const SearchPath, BaseDirectory: string): string;
|
||||
function TrimSearchPath(const SearchPath, BaseDirectory: string;
|
||||
DeleteDoubles: boolean): string;
|
||||
var
|
||||
CurPath: String;
|
||||
EndPos: Integer;
|
||||
@ -1371,15 +1373,18 @@ begin
|
||||
if (BaseDir<>'') and (not FilenameIsAbsolute(CurPath)) then
|
||||
CurPath:=BaseDir+CurPath;
|
||||
CurPath:=ChompPathDelim(TrimFilename(CurPath));
|
||||
if CurPath='' then CurPath:='.';
|
||||
// check if path already exists
|
||||
// ToDo:
|
||||
|
||||
if Result<>'' then
|
||||
CurPath:=';'+CurPath;
|
||||
if CurPath<>'' then
|
||||
Result:=Result+CurPath
|
||||
else
|
||||
Result:=Result+'.';
|
||||
if (not DeleteDoubles)
|
||||
or (SearchDirectoryInSearchPath(SearchPath,CurPath)<1)
|
||||
then begin
|
||||
if Result<>'' then
|
||||
CurPath:=';'+CurPath;
|
||||
if CurPath<>'' then
|
||||
Result:=Result+CurPath
|
||||
else
|
||||
Result:=Result+'.';
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
@ -1401,7 +1401,7 @@ begin
|
||||
AlreadySearchedPaths:=MergeSearchPaths(AlreadySearchedPaths,FullDir);
|
||||
// search with include path of directory
|
||||
if Assigned(OnGetIncludePath) then begin
|
||||
IncludePath:=TrimSearchPath(OnGetIncludePath(FullDir,false),FullDir);
|
||||
IncludePath:=TrimSearchPath(OnGetIncludePath(FullDir,false),FullDir,true);
|
||||
IncludePath:=RemoveSearchPaths(IncludePath,AlreadySearchedIncPaths);
|
||||
if IncludePath<>'' then begin
|
||||
Result:=SearchFileInPath(ShortIncFilename,FullDir,IncludePath,';',[]);
|
||||
|
Loading…
Reference in New Issue
Block a user