cFS-Manager

Information:

I made this program while I was bored and I hardly see anyone trying this out soo here it is lol

This program allows you to load different "drivers" for filesystems, which allows you to interact with them a tiny bit easier.
However, it is currently so simple, that the main thing about it is my WIP custom filesystem "CMX", which is already included in the same Repository.

As this manager expects these custom filesystems to create one single file, which is the "hard drive" in that sense, it may have some issues like probably error-ing out
when the hard drive becomes too big and you try to save ("close") it.

CMX works pretty good, with the abilities to create directories, open, write, read and close files and create links to directories (which was surprisingly easy to do, but I have probably forgotten about something and there are some bugs in it)

CMX's (current) features:
  • Open files (in write, read or append mode) with the abilities to read, write and close them, of course
  • Create directories
  • Create links to existing directories (not fully tested though)
  • List files in a directory
  • Delete files, links or empty directories
  • (Technically also directly interacting with the inodes / blocks, but that's documented in the actual file)
  • The documentation for the methods is ontop of the code as a comment
The Manager's features:
  • Loads up every driver in the "fs_drivers" directory (drivers have to return a table with their methods)
  • Ability to switch between them
  • Set the path where the current driver should store its hard drive (The manager currently only saves the hard drives when switching drivers)
  • Bind the current driver's main methods (makeDir, open, write, etc.) to make you not have to use "self" (i.e. using ":" instead of "." when calling methods)
Example (using CMX):
Spoiler

dofile("customfs_manager.lua")
fs_mgr:setDriver("cmx", "/testHD")						   --Set the driver to CMX and its hard drive path to /testHD (notice that we need the ":" for this)
fs_mgr.makeDir("/testFolder")
fs_mgr.driver:makeLink("/testLink", "/")					 --There is no manager binding for this method, so we're calling it directly (with "self")
print(textutils.serialize(fs_mgr.list("/testLink")))		 --We're trying to list the files inside /testLink, which is a link to /, which means it lists the files inside /
--[[
		It should print something like this:
{
	"testFolder",
	"testLink"
}

]]

GitHub Link