Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getPastebin( code, path ) -- Credits to the devs of CC
- local response = http.get(
- "http://pastebin.com/raw.php?i=" .. textutils.urlEncode( code )
- )
- if response then
- local contents = response.readAll()
- local file = fs.open( path, "w" )
- file.write( contents )
- file.close()
- return true
- else
- return false
- end
- end
- local fail = false
- for i = 1, #tPB do
- term.setCursorPos( 13, 7 )
- term.clearLine()
- write( "Downloading file: " .. tPB[i][1] )
- term.setCursorPos( 13, 8 )
- term.clearLine()
- write( "To path: " .. tPB[i][2] )
- if getPastebin( tPB[i][1], tPB[i][2] ) then
- loadBar()
- else
- fail = true
- break
- end
- end
- if fail then
- term.clear()
- term.setCursorPos( 1, 5 )
- print( "Could not download a file, please restart if your internet is working properly again" )
- local evt = os.pullEvent()
- if evt then
- term.setBackgroundColor( colors.black )
- term.setTextColor( colors.white )
- term.clear()
- term.setCursorPos( 1, 1 )
- if not disc then
- fs.delete( "/myOS" )
- end
- return
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment