godot-console icon indicating copy to clipboard operation
godot-console copied to clipboard

Adding support for FileSystem

Open hanfil opened this issue 4 years ago • 1 comments
trafficstars

I've added a filesystem class and linked it to the Console. This is currently just a Proof-Of-Concept, a basis for future development. A complete linux file structure is therefor not created. In the filesystem class I've added some commands to intereact with the files and directories. cat /etc/passwd should ouput the root user.

The filesystem is modelled after how linux and windows operate, with linked-list. A inode/mft entry list, and a data entry list.

Currently there is no way to add content to files. To replicate linux, the console needs to support StdIn, StdOut, and StdErr; 0, 1, & 2. If we can implement some concepts of that, it's easier then to add piping ( "|", "<", ">"), and add content to files.

hanfil avatar Dec 09 '20 10:12 hanfil

This is really neat!

  1. What you've done for me seems more like an in-memory fs (or fs emulator), correct me if I'm wrong. Because you could just pass commands like ls/cd/... to OS.execute.

  2. Another thing is, this probably won't make into default console configuration.

    Q: Why? A: I want to keep it as simple and flexible as possible, so that on the start you get only basic stuff but it can do a lot.

    Q: What is default configuration? A: This is what you get as soon as you install console and run your game. But that doesn't mean your FS wont be available in the console git repo (if you still would want it to). At some point in time I would love and need to introduce plugins (see issue #24). This would allow greater flexibility and smaller default configuration. Everything that isn't a core functionality could be moved to a plugin which could enabled by an end user, if he needs that functionality. EDIT: Also the nice thing about plugins is that you could develop that plugin in your own repo, not being dependent on me merging your work. This would require however end user to search extra stuff, but it could be easily solved by me having a list of plugins and links to them in console readme.

  3. To replicate linux, the console needs to support StdIn, StdOut, and StdErr

    Totally agree, I'll create and issue for that. If I would have time I would do that my self.

Thanks, this is an awesome POC, would be cool see it developed further. Best.

quentincaffeino avatar Dec 09 '20 12:12 quentincaffeino