Skip to content

Commit

Permalink
FIX: rootfolder was not always with including pathdelim -> leads to o…
Browse files Browse the repository at this point in the history
…pen file issues
  • Loading branch information
PascalCorpsman committed Dec 4, 2024
1 parent f6ceef7 commit 1eee530
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
10 changes: 8 additions & 2 deletions src/ufpc_understand.pas
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@

TFiles = Record
LPISource: String;
RootFolder: String;
RootFolder: String; // Endet immer auf Pathdelim
Files: TFileList;
End;

Expand Down Expand Up @@ -1065,6 +1065,7 @@

Procedure TProject.SetRootFolder(AValue: String);
Begin
AValue := IncludeTrailingPathDelimiter(AValue);
If AValue <> fFiles.RootFolder Then Begin
fChanged := true;
fFiles.RootFolder := AValue;
Expand Down Expand Up @@ -1105,6 +1106,9 @@
// Retry with "old" Style..
fFiles.RootFolder := ini.ReadString('Files', 'RootFolder', '');
End;
If fFiles.RootFolder <> '' Then Begin
fFiles.RootFolder := IncludeTrailingPathDelimiter(fFiles.RootFolder);
End;
fFiles.LPISource := ini.ReadString('Files', 'LPISource', '');
cnt := ini.readInteger('Files', 'Count', 0);

Expand All @@ -1116,8 +1120,10 @@
If (fFiles.RootFolder = '') Or ((fFiles.RootFolder <> '') And Not DirectoryExistsUTF8(fFiles.RootFolder)) Then Begin
ShowMessage('Your project root folder seems to be invalid (old value was: "' + fFiles.RootFolder + '"), please select a correct one for: ' + fGeneral.ProjectName);
fFiles.RootFolder := '';
If SelectDirectory('Root folder for: ' + fGeneral.ProjectName, '', fFiles.RootFolder) Then
If SelectDirectory('Root folder for: ' + fGeneral.ProjectName, '', fFiles.RootFolder) Then Begin
fFiles.RootFolder := IncludeTrailingPathDelimiter(fFiles.RootFolder);
fChanged := true;
End;
End;
End;

Expand Down
7 changes: 4 additions & 3 deletions src/unit1.pas
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(******************************************************************************)
(* FPC Understand 30.03.2023 *)
(* *)
(* Version : 0.27 *)
(* Version : 0.28 *)
(* *)
(* Author : Uwe Schächterle (Corpsman) *)
(* *)
Expand Down Expand Up @@ -66,6 +66,7 @@
(* 0.26 - FIX: Line index after {$I ...} *)
(* 0.27 - ADD: Support recursive {$I ...} *)
(* FIX: Set carety when showing code editor *)
(* 0.28 - FIX: invalid Rootfolder *)
(* *)
(* Known Bugs : - if a project holds 2 units with the same name *)
(* the dependency graph will merge them to one *)
Expand Down Expand Up @@ -94,7 +95,7 @@
StdCtrls, ugraphs, ufpc_understand, ufpcparser, LvlGraphCtrl, Types;

Const
Version = '0.25';
Version = '0.28';
ScrollDelta = 25;

Type
Expand Down Expand Up @@ -1315,7 +1316,7 @@
FPCParser := TFPCParser.Create;
For i := 0 To high(FileList) Do Begin
If FileList[i].Enabled Then Begin
f.Filename := ExtractRelativePath(fProject.RootFolder, FileList[i].FileName);
f.Filename := ExtractRelativePath(IncludeTrailingPathDelimiter(fProject.RootFolder), FileList[i].FileName);
If FPCParser.ParseFile(FileList[i].FileName, SearchPaths) Then Begin
f.FileInfo := FPCParser.FileInfo;
f.Methods := FPCParser.ProcInfos;
Expand Down
2 changes: 1 addition & 1 deletion src/unit2.pas
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@
aProject.ChartStatisticSettings.BoarderForAverageMostComplexFiles := strtointdef(edit8.Text, Default_BoarderForAverageMostComplexFiles);

// Files
aProject.RootFolder := IncludeTrailingPathDelimiter(label6.Caption);
aProject.RootFolder := label6.Caption;
aProject.LPISource := label2.Caption;
For i := 0 To high(fList) Do Begin
fList[i].Enabled := CheckListBox1.Checked[i];
Expand Down

0 comments on commit 1eee530

Please sign in to comment.