From 65d4a142e435a387bd0ef3a0f472550f03bd9eb4 Mon Sep 17 00:00:00 2001 From: Massimo Melina Date: Tue, 16 Jun 2020 23:13:22 +0200 Subject: [PATCH] new 'init' section for events file, executed at each reload --- main.pas | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/main.pas b/main.pas index 1ed9c67..0447f2c 100644 --- a/main.pas +++ b/main.pas @@ -1,4 +1,4 @@ -{ +{ Copyright (C) 2002-2020 Massimo Melina (www.rejetto.com) This file is part of HFS ~ HTTP File Server. @@ -7867,7 +7867,12 @@ finally freeAndNIL(info) end; end; // autoCheckUpdates procedure loadEvents(); -begin eventScripts.fullText:=loadTextFile(cfgpath+EVENTSCRIPTS_FILE) end; +begin +if not newMtime(cfgpath+EVENTSCRIPTS_FILE, eventScriptsLast) then + exit; +eventScripts.fullText:=loadTextFile(cfgpath+EVENTSCRIPTS_FILE); +runEventScript('init'); +end; procedure Tmainfrm.updateCopyBtn(); resourcestring @@ -8124,9 +8129,7 @@ var updateCopyBtn(); keepTplUpdated(); updateCurrentCFG(); - - if newMtime(cfgpath+EVENTSCRIPTS_FILE, eventScriptsLast) then - loadEvents(); + loadEvents(); if assigned(runScriptFrm) and runScriptFrm.visible and runScriptFrm.autorunChk.checked and newMtime(tempScriptFilename, runScriptLast) then