Skip to content

Commit

Permalink
fix #112 more
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexey-T committed Sep 28, 2023
1 parent bf05b7d commit ad769bc
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions form_main.pas
Expand Up @@ -356,6 +356,8 @@ function GetLastFindText: string;
begin
Result:= '';
TCIni:= GetEnvironmentVariable('COMMANDER_INI');
if TCIni='' then Exit;

with TIniFile.Create(TCIni) do
try
S:= ReadString('SearchText', '0', '');
Expand Down Expand Up @@ -406,18 +408,14 @@ procedure SetLastFindText(const AFindText: string);
Free
end;

//be careful to not overwrite some existing file which is not the TC ini,
//see issue #112
TCIni:= ExpandEnvironmentVariables(S);
if FileExists(TCIni) then
begin
with TIniFile.Create(TCIni) do
try
WriteString('SearchText', '0', AFindText);
finally
Free
end;
end;
end;

{ TfmMain }
Expand Down

0 comments on commit ad769bc

Please sign in to comment.