Add fs.mount
JakobDev opened this issue ยท 6 comments
Could you please add fs.mount(table,mountpoint). The table contains functions like open or list. If you edit files in the mountpoint,, it should use the function in the table. e.g. fs.mount({list = function() return {"example"} end},"/mnt"). If you type ls /mnt, it should be show example. This function could be useful for users, who make a programm lsike ftp or truecrypt to integrate their programm in the filesystem.
This is something that's trivial to implement in Lua, in fact there are several examples on the forums already.
However, there is nothing wrong with integrating this sort of functionality into CraftOS. It's not something I've ever found a use for, but I'm sure others could.
One thing to consider though is handling clashes with temporary mounts (such as disk drives). If someone mounts their VFS at /disk
, what do you do if someone then puts a disk in an adjacent disk drive? Ideally the latter would go in /disk1
, but that then requires integrating with the Java side of things.
This seems like a good idea. A few OSs implement their own mount systems but it'd be good to have it be native and be able to rely on having it on all computers.
One thing to consider though is handling clashes with temporary mounts (such as disk drives). If someone mounts their VFS at
/disk
, what do you do if someone then puts a disk in an adjacent disk drive? Ideally the latter would go in/disk1
, but that then requires integrating with the Java side of things.
What happens if there's a folder /disk
and you attach a disk drive? Ideally it'd behave in the same way. Considering fs
is already mostly a Java-side thing, surely this change would be a Java-side change anyway?
What happens if there's a folder /disk and you attach a disk drive?
Last time I checked, very mysterious things. Infact, it will even prevent disk startup randomly. Should probably test that again and make an issue about it if it still happens.
If one such feature gets added, I would like to have the ability to make virtual file systems, like for example a network file system. That'd be great.