ide+lazbuild: fixed expanding ~ on unix in lazarus.cfg, #40363

This commit is contained in:
mattias 2023-07-06 17:31:05 +02:00
parent 606ef3eac7
commit cba7d8388f

View File

@ -162,6 +162,8 @@ begin
end; end;
function GetParamsAndCfgFile: TStrings; function GetParamsAndCfgFile: TStrings;
var
CfgDir: string;
procedure ExpandCfgFilename(var aParam: string); procedure ExpandCfgFilename(var aParam: string);
// expand relative filenames in lazarus.cfg using the path of the cfg, not the currentdir // expand relative filenames in lazarus.cfg using the path of the cfg, not the currentdir
@ -172,9 +174,7 @@ function GetParamsAndCfgFile: TStrings;
for i:=low(LazFileOpts) to high(LazFileOpts) do for i:=low(LazFileOpts) to high(LazFileOpts) do
if LazStartsText(LazFileOpts[i],aParam) then begin if LazStartsText(LazFileOpts[i],aParam) then begin
aFilename:=copy(aParam,length(LazFileOpts[i])+1,length(aParam)); aFilename:=copy(aParam,length(LazFileOpts[i])+1,length(aParam));
aFilename:=ResolveDots(aFilename); aFilename:=ExpandFileNameUTF8(aFilename,CfgDir);
if not FilenameIsAbsolute(aFilename) then
aFilename:=ResolveDots(ExtractFilePath(CfgFileName)+aFilename);
aParam:=LazFileOpts[i]+aFilename; aParam:=LazFileOpts[i]+aFilename;
//debugln(['ExpandCfgFilename ',aParam]); //debugln(['ExpandCfgFilename ',aParam]);
exit; exit;
@ -220,6 +220,7 @@ begin
if Cfg <> nil then begin if Cfg <> nil then begin
Warn := ''; Warn := '';
// insert Cfg at start. For duplicates the latest occurrence takes precedence // insert Cfg at start. For duplicates the latest occurrence takes precedence
CfgDir:=ExtractFilePath(CfgFileName);
for i := 0 to Cfg.Count - 1 do begin for i := 0 to Cfg.Count - 1 do begin
s := Cfg[i]; s := Cfg[i];
if (s <> '') and (s[1] = '-') then if (s <> '') and (s[1] = '-') then