SHOW:
|
|
- or go back to the newest paste.
| 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) |
| 21 | + | skeleton(path) |
| 22 | - | local f=fs.open(fpath,"w") |
| 22 | + | local f=fs.open(path,"w") |
| 23 | if f and content then | |
| 24 | f.write(content) | |
| 25 | f.close() | |
| 26 | end | |
| 27 | end | |
| 28 | end |