Advertisement
ZNZNCOOP

startup

Apr 3rd, 2014
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.04 KB | None | 0 0
  1. local sPath = ".:/rom/programs"
  2. if turtle then
  3.     sPath = sPath..":/rom/programs/turtle"
  4. else
  5.     sPath = sPath..":/rom/programs/computer"
  6. end
  7. if http then
  8.     sPath = sPath..":/rom/programs/http"
  9. end
  10.  
  11. shell.setPath( sPath )
  12. help.setPath( "/rom/help" )
  13.  
  14. shell.setAlias( "ls", "list" )
  15. shell.setAlias( "dir", "list" )
  16. shell.setAlias( "cp", "copy" )
  17. shell.setAlias( "mv", "move" )
  18. shell.setAlias( "rm", "delete" )
  19.  
  20.  
  21. if os._run then
  22.   print("command alredy loaded")
  23.   return
  24. end
  25. os._run=os.run
  26.  
  27. function os.run(...)
  28.   local Arg={...}
  29.   local cmd=Arg[2]
  30.  
  31.   if cmd:match("%.bat$") then
  32.     local file=io.open(cmd,"r")
  33.     if not file then
  34.       print("No such file")
  35.       return false
  36.     end
  37.     local line=file:read()
  38.     while line do
  39.       if not shell.run(line) then
  40.         print("...",line)
  41.         break
  42.       end
  43.       line=file:read()
  44.     end
  45.     file:close()
  46.     return true
  47.   end
  48.  
  49.   return os._run(...)
  50. end
  51. if fs.exists( "autorun.bat" ) and not fs.isDir( "autorun.bat" ) then
  52.     shell.run( "autorun.bat" )
  53. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement