Jump to content




Making A Os?


  • You cannot reply to this topic
10 replies to this topic

#1 turtle5204

  • Banned
  • 34 posts
  • LocationSitting at my computer.

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
|

#2 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

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 immibis

    Lua God

  • Members
  • 1,033 posts
  • LocationWellington, New Zealand

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.

#4 turtle5204

  • Banned
  • 34 posts
  • LocationSitting at my computer.

Posted 21 September 2013 - 05:38 AM

View Postimmibis, 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.
I want it to have a file browser, a great GUI, custom background, color, built-in programs...

#5 Goof

  • Members
  • 751 posts

Posted 21 September 2013 - 11:02 AM

Whoooops totally wrong post here.... Soorry :(

Edited by Mikk809h, 21 September 2013 - 11:02 AM.


#6 Ristyo

  • Members
  • 31 posts
  • LocationIn my computer house located in a random village, programming.

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 BigTwisty

  • Members
  • 106 posts

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.

#8 H4X0RZ

  • Members
  • 1,315 posts
  • LocationGermany

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 :D

#9 CraftedCart

  • Members
  • 67 posts
  • LocationUnited Kingdom, Earth

Posted 22 September 2013 - 02:28 AM

A quick installer could be:
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 Engineer

  • Members
  • 1,378 posts
  • LocationThe Netherlands

Posted 22 September 2013 - 04:55 AM

View PostFreack100, 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 :D/>
Since when can you open a directory?

#11 immibis

    Lua God

  • Members
  • 1,033 posts
  • LocationWellington, New Zealand

Posted 25 September 2013 - 07:12 PM

View PostRistyo, 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.
It's built into ComputerCraft, in Java. You can simulate it with Lua. fs.isReadOnly returns true for read-only files, and some other functions throw errors.

View Postturtle5204, 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...
So your questions are these?
  • 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