Skip to content

Commit e947073

Browse files
FIX: automatically add .lpi path to searchpaths
1 parent 1eee530 commit e947073

File tree

2 files changed

+35
-4
lines changed

2 files changed

+35
-4
lines changed

src/ufpc_understand.pas

+32-2
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@
111111
fFilename: String; // Der Dateiname in dem die Projekteinstellungen gespeichert wurden
112112
fChanged: Boolean;
113113
fCCColors: TCCColors;
114+
Function GetSearchPaths: TPathList;
114115
Procedure SetCCColors(AValue: TCCColors);
115116
Procedure SetFiles(AValue: TFileList);
116117
Procedure SetLPISource(AValue: String);
@@ -130,7 +131,7 @@
130131
Property RootFolder: String read fFiles.RootFolder write SetRootFolder;
131132
Property LPISource: String read fFiles.LPISource write SetLPISource;
132133
Property Files: TFileList read fFiles.Files write SetFiles;
133-
Property SearchPaths: TPathList read FSearchPaths write FSearchPaths; // relativ zu Rootfolder
134+
Property SearchPaths: TPathList read GetSearchPaths write FSearchPaths; // relativ zu Rootfolder
134135

135136
(*
136137
* For Internal Use
@@ -809,7 +810,12 @@
809810
setlength(result, length(PathList));
810811
For i := 0 To high(PathList) Do Begin
811812
result[i] := PathList[i];
812-
result[i].Path := ConcatRelativePath(RootFolder, IncludeTrailingPathDelimiter(result[i].Path));
813+
If result[i].Path = '' Then Begin
814+
result[i].Path := RootFolder;
815+
End
816+
Else Begin
817+
result[i].Path := ConcatRelativePath(RootFolder, IncludeTrailingPathDelimiter(result[i].Path));
818+
End;
813819
End;
814820
End;
815821

@@ -1063,6 +1069,30 @@
10631069
fChanged := true;
10641070
End;
10651071

1072+
Function TProject.GetSearchPaths: TPathList;
1073+
Var
1074+
i: Integer;
1075+
found: Boolean;
1076+
Begin
1077+
result := FSearchPaths;
1078+
// At least make the .lpi file path the searchpath
1079+
If fFiles.LPISource <> '' Then Begin
1080+
// As all paths are relative to the .lpi file path, this is a empty string path
1081+
found := false;
1082+
For i := 0 To high(Result) Do Begin
1083+
If result[i].Path = '' Then Begin
1084+
found := true;
1085+
break;
1086+
End;
1087+
End;
1088+
If Not found Then Begin
1089+
SetLength(result, high(Result) + 2);
1090+
result[High(Result)].Path := '';
1091+
result[High(Result)].FromLPI := true;
1092+
End;
1093+
End;
1094+
End;
1095+
10661096
Procedure TProject.SetRootFolder(AValue: String);
10671097
Begin
10681098
AValue := IncludeTrailingPathDelimiter(AValue);

src/unit1.pas

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
(******************************************************************************)
22
(* FPC Understand 30.03.2023 *)
33
(* *)
4-
(* Version : 0.28 *)
4+
(* Version : 0.29 *)
55
(* *)
66
(* Author : Uwe Schächterle (Corpsman) *)
77
(* *)
@@ -67,6 +67,7 @@
6767
(* 0.27 - ADD: Support recursive {$I ...} *)
6868
(* FIX: Set carety when showing code editor *)
6969
(* 0.28 - FIX: invalid Rootfolder *)
70+
(* 0.29 - FIX: automatically add .lpi path to searchpaths *)
7071
(* *)
7172
(* Known Bugs : - if a project holds 2 units with the same name *)
7273
(* the dependency graph will merge them to one *)
@@ -95,7 +96,7 @@
9596
StdCtrls, ugraphs, ufpc_understand, ufpcparser, LvlGraphCtrl, Types;
9697

9798
Const
98-
Version = '0.28';
99+
Version = '0.29';
99100
ScrollDelta = 25;
100101

101102
Type

0 commit comments

Comments
 (0)