Making A Os?
Started by turtle5204, Sep 20 2013 06:13 PM
10 replies to this topic
#1
Posted 20 September 2013 - 06:13 PM
How would you make a OS? I just need a tutorial, and how to make an installer. I also need help making a directory that cannot be edited.
Progress Tree:
BIOS-------------------|
|---------------BootDrive
|
|---------------BootAntivirus
|
Progress Tree:
BIOS-------------------|
|---------------BootDrive
|
|---------------BootAntivirus
|
#2
Posted 20 September 2013 - 07:08 PM
You cannot create with code a folder than cannot be edited. Installers are pretty simple, they usually just get some files from a website and save the contents.
#3
Posted 21 September 2013 - 02:28 AM
An OS is a program that does certain things. Different people have different opinions of what "certain things" are, especially in ComputerCraft. What do you want it to do?
An installer is just a program that writes other programs to files.
You could override fs.open to disallow opening files in a certain directory.
An installer is just a program that writes other programs to files.
You could override fs.open to disallow opening files in a certain directory.
#4
Posted 21 September 2013 - 05:38 AM
immibis, on 21 September 2013 - 02:28 AM, said:
An OS is a program that does certain things. Different people have different opinions of what "certain things" are, especially in ComputerCraft. What do you want it to do?
An installer is just a program that writes other programs to files.
You could override fs.open to disallow opening files in a certain directory.
An installer is just a program that writes other programs to files.
You could override fs.open to disallow opening files in a certain directory.
#5
Posted 21 September 2013 - 11:02 AM
Whoooops totally wrong post here.... Soorry
Edited by Mikk809h, 21 September 2013 - 11:02 AM.
#6
Posted 21 September 2013 - 11:03 AM
I am still wondering how the console in the Turtle OS could block us from editing the program files.
#7
Posted 21 September 2013 - 02:46 PM
The so-called blocked folders you are talking about don't actually exist in the folder structure of that particular turtle. They are common folders shared between every computer or turtle in the game. The only way to edit them would be from outside the game. For SSP this is fairly easy, but you would need access to the server files for an SMP server.
It would probably be better for an OS to simply override any function with access to the file system and make your system folder artificially invisible.
It would probably be better for an OS to simply override any function with access to the file system and make your system folder artificially invisible.
#8
Posted 21 September 2013 - 05:05 PM
Here, to stop peoples accessing your folders/files:
local fso = fs.open
local fsd = fs.delete
local fsiro = fs.isReadOnly
local blocked = {
["somedir"] = true
}
function fs.open(dir,mode)
if blocked[dir] then
error("Can't access file!",2)
end
return fso(dir,mode)
end
function fs.delete(dir)
if blocked[dir] then
error("Can't access file!",2)
end
return fsd(dir)
end
function fs.isReadOnly(dir)
if blocked[dir] then
return true
end
return fsiro(dir)
end
I hope there aren't any typos #9
Posted 22 September 2013 - 02:28 AM
A quick installer could be:
Hopefully I didn't do anything wrong. It's not very advanced and could be improved on a lot
if http then
file = http.get("URL PATH TO FILE HERE")
if file then
h = fs.open("PATH OF INSTALL HERE", w)
h.write(file.readAll())
h.close()
else
print("Seems like we couldn't find the file")
end
else
print("Looks like you can't access the internet")
end
Hopefully I didn't do anything wrong. It's not very advanced and could be improved on a lot
#10
Posted 22 September 2013 - 04:55 AM
Freack100, on 21 September 2013 - 05:05 PM, said:
Here, to stop peoples accessing your folders/files:
/>
local fso = fs.open
local fsd = fs.delete
local fsiro = fs.isReadOnly
local blocked = {
["somedir"] = true
}
function fs.open(dir,mode)
if blocked[dir] then
error("Can't access file!",2)
end
return fso(dir,mode)
end
function fs.delete(dir)
if blocked[dir] then
error("Can't access file!",2)
end
return fsd(dir)
end
function fs.isReadOnly(dir)
if blocked[dir] then
return true
end
return fsiro(dir)
end
I hope there aren't any typos #11
Posted 25 September 2013 - 07:12 PM
Ristyo, on 21 September 2013 - 11:03 AM, said:
I am still wondering how the console in the Turtle OS could block us from editing the program files.
turtle5204, on 21 September 2013 - 05:38 AM, said:
I want it to have a file browser, a great GUI, custom background, color, built-in programs...
- How do I make a file browser?
- How do I make a great GUI?
- How do I make a custom background?
- How do I make colour?
- How do I make built-in programs?
How do I make a file browser?
Up to you.
How do I make a great GUI?
Up to you. If there was a magic way everyone would be doing it.
How do I make a custom background?
You could use paintutils to display a picture. Or you could use the term API. Up to you.
How do I make colour?
Using term.setBackgroundColour and term.setColour (or use 'color' instead of 'colour', same thing).
How do I make built-in programs?
Well, you make it so that when you install the OS the programs are there. How do you do that? Depends on your OS and installer.
Notice that for all of these things, there isn't a specific way you do it. Eg. there is no function you can call to get a file browser. You have to program it to display files, folders, buttons, scrollbars, etc... on the screen in the right places. You have to program it to know what to do when the user clicks the mouse or presses a key. You have to program it so that when the user clicks a file it displays it, if that's what you want it to do (you have to decide what you want it to do).
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











