From f64c1307f9d0c17975ee9dbf72518bc49378a706 Mon Sep 17 00:00:00 2001 From: Abou Al Montacir Date: Thu, 11 May 2023 11:11:39 +0200 Subject: [PATCH] Issue #39988: Changed order of folders where to search for included files. The order of folders where to search for included files should be related to user preference as follows: 1. directory where the input is located, 2. directories supplied by user at command line in the order they were passed, 3. default system directories, where distributions used to put them. This way, user can easily override files in the default system directories without the need to have write access to such folder, as in most Unix systems this will require root access. Also, one expects, that if copy of an included file is placed in the same directory as the input one, then this copy should be used. This makes sens, because people generally work on the same directory, and will consider their local work copy the preferred one to be used. --- tools/gir2pascal/gir2pascal.lpr | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/gir2pascal/gir2pascal.lpr b/tools/gir2pascal/gir2pascal.lpr index 1a519c1b6f..21b38b3dab 100644 --- a/tools/gir2pascal/gir2pascal.lpr +++ b/tools/gir2pascal/gir2pascal.lpr @@ -258,6 +258,12 @@ begin Halt; end; + FFileToConvert:=FCmdOptions.OptionValue('input'); + AddPaths(ExtractFilePath(FFileToConvert)); + + if FCmdOptions.HasOption('paths') then + AddPaths(FCmdOptions.OptionValue('paths')); + if not FCmdOptions.HasOption('no-default') then AddDefaultPaths; @@ -266,15 +272,9 @@ begin else FOutPutDirectory:=IncludeTrailingPathDelimiter(GetCurrentDir); - FFileToConvert:=FCmdOptions.OptionValue('input'); - AddPaths(ExtractFilePath(FFileToConvert)); - if FCmdOptions.HasOption('unit-prefix') then FUnitPrefix := FCmdOptions.OptionValue('unit-prefix'); - if FCmdOptions.HasOption('paths') then - AddPaths(FCmdOptions.OptionValue('paths')); - if FCmdOptions.HasOption('overwrite-files') then FOverWriteFiles:=True;