Stary2001

Untitled

Oct 11th, 2012
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 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 repo="Stary2001/StaryOS"
  13.  
  14. skeleton(path)
  15. local page=http.get("https://api.bitbucket.org/1.0/repositories/"..repo.."/raw/master/"..path)
  16. local s = page.readAll()
  17. page.close()
  18. local f = fs.open(path,"w")
  19. if f then
  20. f.write(s)
  21. f.close()
  22. else print(path .. " failed for writing!") end
Advertisement
Add Comment
Please, Sign In to add comment