From 9fb368af903d80436ce5a018d56d33b49890ce53 Mon Sep 17 00:00:00 2001 From: masx200 <34191203+masx200@users.noreply.github.com> Date: Mon, 15 May 2023 18:10:33 +0800 Subject: [PATCH] Update install.lua --- install.lua | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/install.lua b/install.lua index e7b30bc1..b63aa3d7 100644 --- a/install.lua +++ b/install.lua @@ -25,12 +25,32 @@ local function movefilesinfolder(src, dest, callback) end end + +local function checkfilesexists(archivefile) + if os.exists(archivefile .. '.list') then + local installedlistfile = io.open(archivefile .. '.list', "r") + if nil == installedlistfile then + print("open file: " .. archivefile .. '.list' .. " fail") + return + end + while (true) do + local content2 = installedlistfile:read("*l") + + if content2 == nil then return true end + + if not os.exists(content2) then return false end + + end + end + return false +end function main() local name = "leetcode-treenode-cpp" local version = "1.1.8" local folder = name .. "-" .. version local archivefile = path.join('downloads', folder .. '.tar.gz') + if checkfilesexists(archivefile) then return end if not os.exists(archivefile) then local url = 'https://ghproxy.com/https://github.com/masx200/' .. name .. '/archive/' .. version .. '.tar.gz'