delete old files before move

This commit is contained in:
jane 2021-06-06 00:31:19 -04:00
parent 90200750cc
commit 8c2d3acdec
2 changed files with 12 additions and 0 deletions

View file

@ -85,9 +85,15 @@ local function finishInstall(files)
for key, file in ipairs(files) do for key, file in ipairs(files) do
if customPath ~= nil then if customPath ~= nil then
print("moving " .. file .. " to " .. customPath .. "...") print("moving " .. file .. " to " .. customPath .. "...")
if fs.exists(customPath .. "/" .. file) then
fs.delete(customPath .. "/" .. file)
end
fs.move(temp .. file, customPath .. "/" .. file) fs.move(temp .. file, customPath .. "/" .. file)
else else
print("moving " .. file .. " to " .. path .. programToInstall .. "...") 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) fs.move(temp .. file, path .. programToInstall .. "/" .. file)
end end
end end

View file

@ -102,9 +102,15 @@ local function finishInstall(files)
for key, file in ipairs(files) do for key, file in ipairs(files) do
if customPath ~= nil then if customPath ~= nil then
print("moving " .. file .. " to " .. customPath .. "...") print("moving " .. file .. " to " .. customPath .. "...")
if fs.exists(customPath .. "/" .. file) then
fs.delete(customPath .. "/" .. file)
end
fs.move(temp .. file, customPath .. "/" .. file) fs.move(temp .. file, customPath .. "/" .. file)
else else
print("moving " .. file .. " to " .. path .. programToInstall .. "...") 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) fs.move(temp .. file, path .. programToInstall .. "/" .. file)
end end
end end