ADD: Create highlighters.xml backup on configuration version change

This commit is contained in:
Alexander Koblov 2023-07-14 20:55:40 +03:00
commit cef1e497e2

View file

@ -839,8 +839,8 @@ end;
procedure THighlighters.Load(const FileName: String);
var
J: LongInt;
AVersion: Integer;
Config: TXmlConfig;
AVersion: Integer = ConfigVersion;
Highlighter: TSynCustomHighlighter;
LanguageName, AttributeName: String;
Attribute: TSynHighlighterAttributes;
@ -897,6 +897,13 @@ begin
end;
// Import colors from old format
if AVersion < 2 then SaveColors;
// Create config backup
if (AVersion < ConfigVersion) then
try
Config.WriteToFile(FileName + '.bak');
except
// Ignore
end;
end;
finally
Config.Free;