#21
Posted 07 November 2015 - 07:26 PM
#22
Posted 07 November 2015 - 10:35 PM
Still not working, getting the same exact error at line 16.
#23
Posted 08 November 2015 - 04:57 AM
ViperLordX, on 07 November 2015 - 10:35 PM, said:
Still not working, getting the same exact error at line 16.
valithor, on 07 November 2015 - 05:58 PM, said:
Also, when you do eventually switch over to the one I gave you, you will realize you are getting a error on line 65 of edit. In which case you will need to overwrite io.open in the same way you overwrote fs.open.
local oldResolveProgram = shell.resolveProgram
shell.resolveProgram = function(path)
if oldResolveProgram(path) ~= nil then --# checking if it is nil without the "q/" added on. Essentially if the path is for rom, or a disk
return oldResolveProgram(path) --# returning it sense it isn't nil
else
return oldResolveProgram("q/"..path) --# returning the "q/" path
end
end
local oldIoOpen = io.open
io.open = function(path,mode)
return oldIoOpen(cover(path),mode)
end
Just replace your shell overwrite with this... If it doesn't work then come back and ask for help. It doesn't even appear you have tested it since so you have not said anything about it though I have posted 3 times.
Edited by valithor, 08 November 2015 - 04:59 AM.
#24
Posted 08 November 2015 - 06:50 PM
#25
Posted 08 November 2015 - 07:27 PM
ViperLordX, on 08 November 2015 - 06:50 PM, said:
No... I agreed with them in the respect you shouldn't need to overwrite it, however, with the code you posted here and how you overwrite the fs api it is necessary. If you were to change how you overwrite the fs api then no you shouldn't need to overwrite io.open.
Edit:
Chances are... You just need to fix how you overwrite the fs api, and then you wouldn't need to overwrite anything in shell (the way you overwrote shell caused the too long without yielding error).
Edited by valithor, 08 November 2015 - 07:30 PM.
#26
Posted 08 November 2015 - 07:36 PM
Oh, does fs.combine() use shell.resolve() so when I do cover() in shell.resolve(), it calls itself recursively?
Edited by ViperLordX, 08 November 2015 - 07:37 PM.
#27
Posted 08 November 2015 - 09:17 PM
ViperLordX, on 08 November 2015 - 07:36 PM, said:
Oh, does fs.combine() use shell.resolve() so when I do cover() in shell.resolve(), it calls itself recursively?
function hell.resolveProgram(name) return hell.resolveProgram(cover(name)) end
That code is taken from what you posted. As you can see it defines hell.resolveProgram, and then the only thing that the function does is call hell.resolveProgram... It is calling itself over and over. It does not crash from the CC recursive limit due to the fact you are returning the function, hence the reason it crashes without too long without yielding.
How to fix it:
Completely remove the shell overwrite, and change the line:
fs = vfs
to
_G.fs = vfs
As lyqyd said.
Just going to say... the fix I posted 3 times actually did fix your problem. Very annoyed you did not even try it, and continued to say your code did not work although I provided a working solution.
Edited by valithor, 08 November 2015 - 09:18 PM.
#28
Posted 09 November 2015 - 11:53 PM
#29
Posted 10 November 2015 - 12:00 AM
#30
Posted 11 November 2015 - 04:38 AM
ViperLordX, on 09 November 2015 - 11:53 PM, said:
If you change it to _G.fs = vfs, then you must remove the shell overwrite as well. The entire reason the shell overwrite was every needed was because the fs api used in shell.resolveProgram was not being changed (explained by lyqyd). I tested it without the shell overwrite, and it did exactly what you wanted it to do.
ViperLordX, on 10 November 2015 - 12:00 AM, said:
I am not going to pretend I have a lot of experience with LUA metatables... because I do not. However, if I understand correctly, then overwriting the shell api that way is almost exactly the same as the code below (the test I did also supports this statement):
local hell = {}
hell.resolveProgram = function(...)
return shell.resolveProgram(cover(...))
end
shell = hell
I think I explained why this won't work earlier, and from my tests this is basically what your overwrite was doing. This is the main difference between our ways of overwriting it.
If you want a better way to overwrite it, then remove the shell overwrite (and io overwrite), and just change that one line. As I admitted in my first post, I did not spend much time actually looking at the code, as I was in class when I made that first post. I just narrowed it down hoping someone else would pick it up and continue to help. As such the solution I provided was aimed at the effect instead of the cause of your problem, so although it works it is not the most efficient way to fix the problem.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











