From c018dfafb93496d85318603e237ec1e82ea49bc1 Mon Sep 17 00:00:00 2001 From: martin Date: Mon, 18 Nov 2019 22:43:04 +0000 Subject: [PATCH] IDE: Code-Templates, use default (from resource) if file does not exist. git-svn-id: trunk@62271 - --- ide/editoroptions.pp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ide/editoroptions.pp b/ide/editoroptions.pp index 5c82c5f86b..1c07fb1f6d 100644 --- a/ide/editoroptions.pp +++ b/ide/editoroptions.pp @@ -5237,6 +5237,8 @@ function TEditorOptions.LoadCodeTemplates(AnAutoComplete: TSynEditAutoComplete ): TModalResult; var s: String; + data: TResourceStream; + i: Int64; begin s := CodeTemplateFileNameExpand; Result := mrAbort; @@ -5247,6 +5249,16 @@ begin except Result := mrAbort; end; + end + else begin + data := TResourceStream.Create(HInstance, PChar('lazarus_dci_file'), PChar(RT_RCDATA)); + i := data.Size; + if i > 0 then begin + SetLength(s, i); + data.Read(s[1], i); + AnAutoComplete.AutoCompleteList.Text := s; + end; + data.Free; end; end;