This commit is contained in:
Igor Timofeev
2017-08-24 13:18:48 +03:00
parent e932b3d49f
commit 58fe2d9508
2 changed files with 15 additions and 13 deletions

View File

@@ -1199,19 +1199,21 @@ function MineOSCore.newFileFromURL(parentWindow, path)
container.inputFieldURL = container.layout:addChild(GUI.inputField(1, 1, 36, 3, 0xEEEEEE, 0x666666, 0x666666, 0xEEEEEE, 0x262626, nil, "URL", false))
container.inputField.onInputFinished = function()
if fs.exists(path .. container.inputField.text) then
container.label.hidden = false
parentWindow:draw()
buffer.draw()
else
if container.inputFieldURL.text then
local success, reason = require("web").downloadFile(container.inputFieldURL.text, path .. container.inputField.text)
if not success then
GUI.error(reason)
end
if container.inputField.text then
if fs.exists(path .. container.inputField.text) then
container.label.hidden = false
parentWindow:draw()
buffer.draw()
else
if container.inputFieldURL.text then
local success, reason = require("web").downloadFile(container.inputFieldURL.text, path .. container.inputField.text)
if not success then
GUI.error(reason)
end
container:delete()
computer.pushSignal("MineOSCore", "updateFileList")
container:delete()
computer.pushSignal("MineOSCore", "updateFileList")
end
end
end
end