From c35742a24db03b7e9176eda7269b548207e01f4d Mon Sep 17 00:00:00 2001 From: kake26 Date: Thu, 5 Jan 2023 18:36:01 +0000 Subject: [PATCH] Update 'update.pl' Proper fetching of index2.json as part of the update process. Also proper rotating and re indexing of index.json as part of the update check. --- update.pl | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/update.pl b/update.pl index 7128678..343a68c 100644 --- a/update.pl +++ b/update.pl @@ -85,13 +85,24 @@ sub do_update ($mod,$ver,$author) { # print "Update info $mod $ver $author\n"; } +sub update_files () { +# This is triggered when mod updates are detected +system("rm index.json"); +system("cp index2.json index.json"); +system("rm mods"); +undef(%conf); +&get_ready(); +return; +} # Maybe get ready and check update should be called every time if (-e "mods"){ # load data print "Loading data\n"; $conf = retrieve('mods'); + get_file(); chk_update(); + update_files(); }else{ get_ready(); # chk_update expects a hash retrived from storables so program needs to be run again after this