diff --git a/Changelog.md b/Changelog.md
index de70050..9453408 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -4,6 +4,8 @@
- Calendar versioning, `YY.MINOR.MICRO`
+- If the file system is activate, system activity will be logged
+
- Build number based on commit hash
Due to the huge time skip and architectural changes, I've (retroactively) switched to calendar versioning with ``v0.1`` now known as ``v20.1`` as well.
diff --git a/README.md b/README.md
index e324f81..41a0ebc 100644
--- a/README.md
+++ b/README.md
@@ -8,12 +8,16 @@ TOMAS (**To**ny's **Ma**naged Operating **S**ystem) is a hobby operating system
### Prerequisites
-- Operating System
- - Visual Studio 2022
- - COSMOS User Kit v2022 or later
- - VMWare Workstation Player
+- Windows 10 or later
+
+- Visual Studio 2022
+
- .NET 6 or later
+- COSMOS User Kit v2022 or later
+
+- VMWare Workstation Player
+
## License
This project is licensed under the BSD 3-Clause license - see the [LICENSE](LICENSE) file for details.
diff --git a/src/Tomas.Common/SysMeta.cs b/src/Tomas.Common/SysMeta.cs
index c9f1c90..79ffd67 100644
--- a/src/Tomas.Common/SysMeta.cs
+++ b/src/Tomas.Common/SysMeta.cs
@@ -32,7 +32,7 @@ public struct SysMeta
///
/// Let's the system know that the file system is activated.
///
- public static bool IsFSActive = false;
+ public static bool IsFSActive { get; set; } = false;
///
/// Generates the build number from the commit hash.
diff --git a/src/Tomas.Kernal/Kernel.cs b/src/Tomas.Kernal/Kernel.cs
index 3705c9c..e5f4150 100644
--- a/src/Tomas.Kernal/Kernel.cs
+++ b/src/Tomas.Kernal/Kernel.cs
@@ -8,8 +8,12 @@ public class Kernel : Os.Kernel
protected override void BeforeRun()
{
- Console.Clear();
- Console.WriteLine("TOMAS booted successfully.");
+ SysFS.Initialize();
+
+ if (!SysMeta.IsFSActive)
+ Console.WriteLine($"{SysMeta.NAME} booted with errors.");
+ else
+ Console.WriteLine($"{SysMeta.NAME} booted successfully.");
}
protected override void Run()
diff --git a/src/Tomas.Kernal/SysFS.cs b/src/Tomas.Kernal/SysFS.cs
new file mode 100644
index 0000000..56f4d58
--- /dev/null
+++ b/src/Tomas.Kernal/SysFS.cs
@@ -0,0 +1,133 @@
+// I license this project under the BSD 3-Clause license.
+// See the LICENSE file in the project root for more information.
+
+namespace Tomas.Kernel;
+
+static class SysFS
+{
+ // The root directory of the file system
+ const string ROOT_DIR = "0:\\";
+ // The system directory, located in the root directory
+ static string SYSTEM_DIR = $"{ROOT_DIR}\\SYSTEM\\";
+
+ static string LOG_FILE = $"{SYSTEM_DIR}system.log";
+
+ // An instance of the CosmosVFS class, used for accessing the virtual file system
+ static readonly CosmosVFS _fs = new();
+
+ ///
+ /// Initializes the file system by creating the system directory and sysinfo.txt file
+ /// and setting the IsFSActive property of the SysMeta class to true
+ ///
+ public static void Initialize()
+ {
+ try
+ {
+ var createSysFiles = "Creating system files.";
+ var setSysPref = "Writing system info.";
+ var fsSuccess = "File system succesfully initialized.";
+
+ // Register the CosmosVFS instance as the virtual file system
+ VFSManager.RegisterVFS(_fs);
+
+ // Create the system directory
+ _fs.CreateDirectory(SYSTEM_DIR);
+
+ _fs.CreateFile($"{SYSTEM_DIR}{LOG_FILE}");
+
+ Console.WriteLine(createSysFiles);
+ File.AppendAllText(LOG_FILE, createSysFiles);
+
+ // Create the sysinfo.txt file in the system directory
+ _fs.CreateFile($"{SYSTEM_DIR}sysinfo.txt");
+
+ Console.WriteLine(setSysPref);
+
+ File.AppendAllText(LOG_FILE, setSysPref);
+
+ // Write the system name, version, and build number to the sysinfo.txt file
+ File.WriteAllText($"{SYSTEM_DIR}sysinfo.txt", $"{SysMeta.NAME} v{SysMeta.VERSION} ({SysMeta.BuildNumber})");
+
+ Console.WriteLine(fsSuccess);
+ File.AppendAllText(LOG_FILE, fsSuccess);
+
+ // Set the IsFSActive property of the SysMeta class to true
+ SysMeta.IsFSActive = true;
+
+ // Read the contents of the sysinfo.txt file and print it to the console
+ var systemInfo = File.ReadAllText($"{SYSTEM_DIR}sysinfo.txt");
+
+ Console.WriteLine(systemInfo);
+ }
+ catch (Exception err)
+ {
+ // If an exception is caught, print an error message indicating that the file system failed to load
+ Console.WriteLine($"{err.Message}{Environment.NewLine}Warning: Error messages will not logged.");
+ }
+ }
+
+ ///
+ /// Creates a new directory at the specified path
+ ///
+ /// directory
+ public static void CreateDirectory(string directory)
+ {
+ try
+ {
+ // Create the directory using the CosmosVFS instance
+ _fs.CreateDirectory($"{ROOT_DIR}\\{directory}");
+ }
+ catch (IOException err)
+ {
+ // If an exception is caught, print an error message indicating the error
+ Console.WriteLine(err.Message);
+ File.AppendAllText(LOG_FILE, err.Message);
+ }
+ }
+
+ ///
+ /// Creates a new file at the specified path
+ ///
+ /// file path
+ /// file
+ public static void CreateFile(string path, string file)
+ {
+ try
+ {
+ // Create the file using the CosmosVFS instance
+ _fs.CreateFile($"{ROOT_DIR}\\{path}\\{file}");
+ }
+ catch (IOException err)
+ {
+ // If an exception is caught, print an error message indicating the error
+ Console.WriteLine(err.Message);
+ File.AppendAllText(LOG_FILE, err.Message);
+ }
+ }
+
+ ///
+ /// Lists all directories in the specified path
+ ///
+ /// path to directory
+ /// returns a list of directories
+ public static string[] ListDirectories(string path)
+ {
+ try
+ {
+ // Get the directories in the specified path using the Directory.GetDirectories method
+ var dirs = Directory.GetDirectories(path);
+
+ // Return the directories
+ return dirs;
+ }
+ catch (IOException err)
+ {
+ // If an exception is caught, print an error message indicating the error
+ Console.WriteLine(err.Message);
+ File.AppendAllText(LOG_FILE, err.Message);
+
+ throw;
+ }
+ }
+}
+
diff --git a/src/Tomas.Kernal/TomFS.cs b/src/Tomas.Kernal/TomFS.cs
deleted file mode 100644
index eca77af..0000000
--- a/src/Tomas.Kernal/TomFS.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-// I license this project under the BSD 3-Clause license.
-// See the LICENSE file in the project root for more information.
-
-namespace Tomas.Kernel;
-
-class TomFS
-{
- public const string ROOT_DIR = "0:\\";
- public static string SYSTEM_DIR = $"{ROOT_DIR}\\SYSTEM\\";
-
- public static void Initialize()
- {
- try
- {
- var fs = new CosmosVFS();
- VFSManager.RegisterVFS(fs);
- fs.CreateDirectory(SYSTEM_DIR);
- Console.WriteLine("Creating system files.");
- fs.CreateFile($"{SYSTEM_DIR}sysinfo.txt");
- Console.WriteLine("Setting system preferences.");
- File.WriteAllText($"{SYSTEM_DIR}sysinfo.txt", $"{SysMeta.NAME} v{SysMeta.VERSION} ({SysMeta.BuildNumber})");
- Console.WriteLine("File system loaded sucesfully.");
- var intro = File.ReadAllText($"{SYSTEM_DIR}sysinfo.txt");
- Console.WriteLine(intro);
-
- }
- catch
- {
- Console.WriteLine("File system failed to load! Not all functions will work.");
- }
- }
-
- public static string[] ListDirectories(string path)
- {
- try
- {
- var dirs = Directory.GetDirectories(path);
- return dirs;
- }
- catch
- {
- Console.WriteLine("Failed to find any directories.");
- throw;
- }
- }
-}