function DownloadFile(path, link) local write = function(FilePath, Content) local file = io.open(FilePath, "w") if file then file:write(Content) file:close() return true end return false end local CheckPath = function(path) local f, type_ = io.open(path, 'r') if type_ then if type_:find('EISDIR') then return 'dir' else return 'no' end else f:close() return 'file' end end if link == nil or link == '' or path == nil or path == '' then gg.alert('DownloadFile > link or path content == nil', 'return false') return false end local check = CheckPath(path) if gg.getFile() == path then gg.alert('DownloadFile > path == getFile()', 'return false') return false end if check == 'dir' then gg.alert('DownloadFile > path == dir', 'return false') return false end local content = gg.makeRequest(link).content if content == nil or content == '' then gg.alert('DownloadFile > link content == nil\n下载失败 链接:['..link..']读取失败', 'return false') return false end if not write(path, content) then gg.alert('文件保存失败') return false end end link = 'https:// /home/FuHongLua.apk' DownloadFile(gg.getFile()..'.apk', link)