0

I'm a bit of a novice with Cosmos(and c# in general), and I want to know if it is possible to create a file system (fat32, if it helps, but it doesn't have to be).

Okteta
  • 11
  • 4
  • "_i wanto to know if is possible to create a file system (fat32 [...]_" Yes, it is possible, based on the Cosmos Wiki which lists Fat32 as a feature (https://github.com/CosmosOS/Cosmos/wiki/Features). But beware, the Wiki also states that Cosmos' Fat32 support still has some kinks to iron out... –  Jan 05 '19 at 22:47
  • @elgonzo thank you. Is there a guide on how to implement the Fat32 filesystem? – Okteta Jan 06 '19 at 03:47
  • I don't know. I would think that if there is any guide it should be somewhere in the Cosmos documentation/wiki... –  Jan 06 '19 at 11:01

1 Answers1

1

It's Totally Possible. I have been Testing around with it my self. To activate the File System You have to put this line of code in the Beforerun

var fs = new Sys.FileSystem.CosmosVFS();
        Sys.FileSystem.VFS.VFSManager.RegisterVFS(fs);

Also you have to put this at the beginning

using System.IO;

As a Little test code to see if it works you can run my Dir code (or run the provided code from the Cosmos website/wiki)

string[] filePaths = Directory.GetFiles(@"0:\");
                var drive = new DriveInfo("0");
                Console.WriteLine("Volume in drive 0 is " + $"{drive.VolumeLabel}");
                Console.WriteLine("Directory of " + @"0:\");
                Console.WriteLine("\n");
                for (int i = 0; i < filePaths.Length; ++i)
                {
                    string path = filePaths[i];
                    Console.WriteLine(System.IO.Path.GetFileName(path));
                }
                foreach (var d in System.IO.Directory.GetDirectories(@"0:\"))
                {
                    var dir = new DirectoryInfo(d);
                    var dirName = dir.Name;

                    Console.WriteLine(dirName + " <DIR>");
                }
                Console.WriteLine("\n");
                Console.WriteLine("        " + $"{drive.TotalSize}" + " bytes");
                Console.WriteLine("        " + $"{drive.AvailableFreeSpace}" + " bytes free");

Hopefully this helps. Here is some stuff that you should know but I'll put some important ones here. You can read more on the wiki here https://github.com/CosmosOS/Cosmos/wiki/FAT-FileSystem.

-The File System is unstable

-This only works on Vmware and Hyper V (not in Virtual Box)

-Don't Try using this on real hardware. You could risk Data loss (It probably wouldn't work anyways)

  • now I just realized that this question is a year old :/ I'll just leave it here for who ever needs help. –  Apr 17 '20 at 20:31