Stary2001

grab

Sep 3rd, 2012
12
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.60 KB | None | 0 0
  1. function skeleton(path)
  2.   local tmp_path=""
  3.   for comp in string.gmatch(path,"(.-)/") do
  4.     tmp_path=tmp_path.."/"..comp
  5.     if not fs.exists(tmp_path) then fs.makeDir(tmp_path) end
  6.   end
  7. end
  8.  
  9.  
  10. local args={...}
  11. local path=args[1]
  12. local over=args[2]
  13.  
  14. local repo="Stary2001/ArchMine"
  15.  
  16. if not fs.exists(path) or over then
  17.   local page=http.get("https://raw.github.com/"..repo.."/master/"..path)
  18.   if page then
  19.     local content=page.readAll()
  20.     page.close()
  21.     skeleton(fpath)
  22.     local f=fs.open(fpath,"w")
  23.     if f and content then
  24.       f.write(content)
  25.       f.close()
  26.     end
  27.   end
  28. end
Advertisement
Add Comment
Please, Sign In to add comment