1619 posts
Posted 05 August 2013 - 01:45 PM
So I'm writing an operating system, and started adding file permissions yesterday. I started replacing functions in FS with my own, but had to go, so I shut down CCDesk. Today I started it up again, but now I cannot use the edit program, or anything else that uses the FS API. I've made a lot of work and don't want to restart. Is it possible to "restore" the FS API back to its original state? Thanks
–Dlcruz
504 posts
Location
Seattle, WA
Posted 05 August 2013 - 02:03 PM
Is your OS overwriting the FS API every time you start a new computer in CC Desk or are you making the changes in the bios.lua file?
Either way, you'll want to hold on to the original FS API by creating a copy of all of the functions in the _G.fs table before overwriting the functions. Using that table, you could either reference it directly in order to keep the overwritten functions and the original functions, and or you could write a function to restore the original FS API.
Copying the functions code example:
Spoiler
_G.originalFsAPI = {}
-- Populate our copy of the original FS API before overwriting it.
for functionName, _function in pairs (_G.fs) do
_G.originalFsAPI[functionName] = _function
end
-- Overwrite the FS API here.
Restoration function example:
Spoiler
function restoreFsAPI()
for functionName, _function in pairs (_G.originalFsAPI) do
_G.fs[functionName] = _function
end
_G.originalFsAPI = nil
end
997 posts
Location
Wellington, New Zealand
Posted 05 August 2013 - 05:10 PM
Go to %appdata%\.minecraft\computer\<computer ID> and rename startup to something else, so it won't run. Then reboot the computer in CCDesk.
1619 posts
Posted 06 August 2013 - 12:38 PM
Go to %appdata%\.minecraft\computer\<computer ID> and rename startup to something else, so it won't run. Then reboot the computer in CCDesk.
Dunno why I didn't think of that. Thanks!