From 8c2d3acdec1af1edf53995007e7556265835bbd5 Mon Sep 17 00:00:00 2001 From: Jane Petrovna Date: Sun, 6 Jun 2021 00:31:19 -0400 Subject: [PATCH] delete old files before move --- projects/updater/install.lua | 6 ++++++ projects/updater/update.lua | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/projects/updater/install.lua b/projects/updater/install.lua index 36bcc55..4a3ea80 100644 --- a/projects/updater/install.lua +++ b/projects/updater/install.lua @@ -85,9 +85,15 @@ local function finishInstall(files) for key, file in ipairs(files) do if customPath ~= nil then print("moving " .. file .. " to " .. customPath .. "...") + if fs.exists(customPath .. "/" .. file) then + fs.delete(customPath .. "/" .. file) + end fs.move(temp .. file, customPath .. "/" .. file) else print("moving " .. file .. " to " .. path .. programToInstall .. "...") + if fs.exists(path .. programToInstall .. "/" .. file) then + fs.delete(path .. programToInstall .. "/" .. file) + end fs.move(temp .. file, path .. programToInstall .. "/" .. file) end end diff --git a/projects/updater/update.lua b/projects/updater/update.lua index 226d8cb..b8b9ec9 100644 --- a/projects/updater/update.lua +++ b/projects/updater/update.lua @@ -102,9 +102,15 @@ local function finishInstall(files) for key, file in ipairs(files) do if customPath ~= nil then print("moving " .. file .. " to " .. customPath .. "...") + if fs.exists(customPath .. "/" .. file) then + fs.delete(customPath .. "/" .. file) + end fs.move(temp .. file, customPath .. "/" .. file) else print("moving " .. file .. " to " .. path .. programToInstall .. "...") + if fs.exists(path .. programToInstall .. "/" .. file) then + fs.delete(path .. programToInstall .. "/" .. file) + end fs.move(temp .. file, path .. programToInstall .. "/" .. file) end end