Advertisement
Marlingaming

File Navigator

Apr 8th, 2022 (edited)
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. local tArg = {...}
  2. local UserKeys = {}
  3.  
  4. function Nav(Dir)
  5. App.Clear()
  6. App.newText("path",Dir,3,1)
  7. App.newButton("return","<-","tsk."..fs.getDir(Dir),1,1)
  8. local list = fs.list(Dir)
  9. for i = 1, #list do
  10. local text
  11. if fs.isDir(list[i]) then
  12. text = "/"..list[i]
  13. else
  14. text = list[i]
  15. end
  16. App.newButton("path"..i,text,"tsk."..fs.combine(Dir,list[i]),2, i + 2)
  17. end
  18. end
  19.  
  20. function getKeys()
  21. local file = fs.open(fs.combine("os/System/Users",settings.get("active_user"),"UserKeys.txt")),"r")
  22. UserKeys = textutils.unserialize(file.readAll())
  23. file.close()
  24. end
  25.  
  26. function CheckKeys(file)
  27. local Pass = Sec.CheckAccess(file)
  28. if Pass == true then
  29. shell.run("edit",file)
  30. else
  31. App.Clear()
  32. App.newButton("error","missing file key","tsk."..fs.getDir(file),1,5)
  33. end
  34. end
  35.  
  36. getKeys()
  37. if tArg[1] == "start" then
  38. Nav("os/System")
  39. else
  40. if fs.isDir(tArg[1]) then
  41. Nav(tArg[1])
  42. else
  43. CheckKeys(tArg[1])
  44. end
  45. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement