make dir if does not exist

This commit is contained in:
jane 2021-06-06 00:33:47 -04:00
parent 8c2d3acdec
commit 1d58f51ba4
2 changed files with 25 additions and 13 deletions

View File

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

View File

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