This is a read-only snapshot of the ComputerCraft forums,
taken in April 2020.
Make program global
Started by jesusthekiller, 20 April 2013 - 09:27 AMPosted 20 April 2013 - 11:27 AM
Howdy, I have an problem while making my OS - How do I make programs global (if it's possible) without editing mod files (like for example "edit" is global)?
Thanks for help :)/>
Posted 20 April 2013 - 11:34 AM
IIRC, the shell first checks the CWD to see if the file is there then if so runs it, if it isn't in there then it checks the ROM and if it is in runs it, if not it does nothing.
Posted 20 April 2013 - 11:36 AM
mkay, gonna have to overwrite CC's console or fs D:
Posted 20 April 2013 - 11:38 AM
For a single file to be available on all computers, it needs to be in /rom/ someplace, in the mod's files, on the server.
Posted 20 April 2013 - 11:39 AM
I believe he meant on the single computer that you can access in any CWD like the scripts in ROM.For a single file to be available on all computers, it needs to be in /rom/ someplace, in the mod's files, on the server.
Posted 20 April 2013 - 11:41 AM
I believe he meant on the single computer that you can access in any CWD like the scripts in ROM.For a single file to be available on all computers, it needs to be in /rom/ someplace, in the mod's files, on the server.
Exactly
Posted 20 April 2013 - 11:45 AM
I believe he meant on the single computer that you can access in any CWD like the scripts in ROM.For a single file to be available on all computers, it needs to be in /rom/ someplace, in the mod's files, on the server.
Ah. His original post was ambiguous.
OP, look into shell.path (or shell.getPath, I can never remember which it is) and shell.setPath.
Posted 20 April 2013 - 11:47 AM
mkay :)/>
Posted 20 April 2013 - 11:49 AM
OP, look into shell.path (or shell.getPath, I can never remember which it is) and shell.setPath.
The shell path function always confused me. I wish it were just a combined getter and setter, so you could do something like this:
shell.path(shell.path() .. ':/bin')
Posted 20 April 2013 - 11:50 AM
Yeah, there is no documentation about shell.path() in wiki. Anyone has an example code?
Posted 20 April 2013 - 12:30 PM
shell.path() returns the path, shell.setPath() sets the current path. To append "/bin" to the current path (like I did before):
The colon is there because each individual path is separated by a colon. If you wanted to add more paths, you could make a nice function for it:
Or something like that.
shell.setPath(shell.path() .. ':/bin')
The colon is there because each individual path is separated by a colon. If you wanted to add more paths, you could make a nice function for it:
function addPath(path)
shell.setPath(shell.path()..':'..path)
end
addPath '/bin'
addPath '/usr/home'
addPath '/usr/lib'
Or something like that.
Posted 20 April 2013 - 12:42 PM
Thanks! :)/>