Advertisement
Hbomb_79

Titanium Packager Installer

Oct 31st, 2016
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.18 KB | None | 0 0
  1. --[[
  2.     This program aims to help developers by providing an easy way to download the Titanium Packager
  3.     which should be used by all programs running via Titanium.
  4.  
  5.     The packager handles the downloading and loading of Titanium, as well as classes and
  6.     files using a virtual file system.
  7.  
  8.     Usage: pastebin run 3hVHPYhH <path> [branch]
  9.  
  10.     The 'branch' parameter defines the target branch to download the packager from. This defaults to 'develop'
  11. ]]
  12.  
  13. local args = { ... }
  14. if not args[ 1 ] then
  15.     return error "A argument must be given that determines the path that the packager will be downloaded to"
  16. end
  17.  
  18. if not http then
  19.     return error "This program requires the HTTP API be loaded. Please load the HTTP API to continue (this maybe a problem with your CC configuration)"
  20. end
  21.  
  22. local handle = http.get("https://gitlab.com/hbomb79/Titanium/raw/"..( args[ 2 ] or "develop" ).."/bin/package.lua")
  23. if not handle then
  24.     return error "Failed to fetch packager, http GET failed. Ensure you have internet connection, otherwise try again later"
  25. end
  26.  
  27. local content = handle.readAll()
  28. handle.close()
  29.  
  30. local dest = fs.open( args[ 1 ], "w" )
  31. dest.write( content )
  32. dest.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement