Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ----- RUX_OS(v0.1) --- TripleHeartGaming -----
- --Local_Variables--
- local osVer = "v0.1"
- local osLabel = "----- RUX_OS(" .. osVer ..") --- TripleHeartGaming -----"
- local closeOS = false
- local firstRun = true
- local userDatabase = "/disk/Rux_OS/Data/users/*"
- local userConfigData = {}
- local users = {}
- local apiFileDir = "/disk/Rux_OS/APIs/"
- local apiFileSearch = "/disk/Rux_OS/APIs/*"
- local apiList = fs.find(apiFileSearch)
- local loggedIn = false
- local defaultUser = "user"
- local defaultPass = "Pass123"
- --End_Local_Variables--
- --Global_Variables--
- --Periph Connection Data
- pConnections = {}
- pConnections.obj = {}
- pConnections.type = {}
- pConnections.side = {}
- --End_Global_Variables--
- --OS_Functions--
- ---Local_Functions---
- local function LoadAPIs()
- local startTime = os.clock()
- local apiCount = #apiList
- local failCount = 0
- local failList = {}
- term.clear()
- term.setCursorPos(1,1)
- print("Loading Rux_OS APIs ...")
- for i=1,#apiList,1 do
- local tmpAPI = string.sub(apiList[i], #apiFileDir)
- print("Loading - " , tmpAPI)
- if os.loadAPI(apiList[i]) then
- print ("API : ", tmpAPI, " has been loaded!")
- else
- --TODO:: Log error here
- print ("API : ", tmpAPI, " has failed to load!")
- failCount = failCount + 1
- failList[failCount].name = tmpAPI
- failList[failCount].path = apiList[i]
- end
- end
- local endTime = os.clock()
- local loadTime = endTime - startTime
- print("------APIs loaded in - ", loadTime, " seconds!------")
- term.setTextColor(colors.green)
- print("--APIs Loaded : ", apiCount - failCount)
- if failCount > 0 then
- term.setTextColor(colors.red)
- print("--APIs Failed : ", failCount)
- for i=1,failCount,1 do
- --TODO:: LOG ERROR TO FILE
- write("--", failList[i].name)
- end
- write("\r\n")
- else
- term.setTextColor(colors.green)
- print("--All APIs have loaded succesfully!")
- end
- end
- function LoadUserData()
- local cursorStartX,cursorStartY = term.getCursorPos()
- local userList = fs.find(userDatabase)
- local userCount = #userList
- local userId = {}
- for i=1,userCount,1 do
- term.setCursorPos(cursorStartX,cursorStartY)
- term.clearLine()
- print("--Loading Users-- (", i , "/", #userDatabase, ")")
- userId[i] = string.sub(userList[i],1, #userDatabase - 1)
- LoadUserConfig(userId[i])
- return userId
- end
- function LoadUserConfig(userID)
- --TODO
- end
- --ENTRYPOINT--
- while not closeOS do
- print(osLabel)
- LoadAPIs()
- LoadUserData()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement