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
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

View File

@ -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