mirror of
https://github.com/tonytins/tomas.git
synced 2025-06-25 10:04:43 -04:00
Refreshed project to target .NET 6 and latest userkit
- Fixed a slight oversight
This commit is contained in:
parent
4f0863f429
commit
7c16857c9a
13 changed files with 182 additions and 16 deletions
52
src/Tomas.Kernal/TomFS.cs
Normal file
52
src/Tomas.Kernal/TomFS.cs
Normal file
|
@ -0,0 +1,52 @@
|
|||
// I license this project under the GPL 3.0 license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
using System;
|
||||
using System.IO;
|
||||
using Cosmos.System.FileSystem;
|
||||
using Cosmos.System.FileSystem.VFS;
|
||||
using Tomas.Common;
|
||||
|
||||
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", $"{ComConsts.NAME}, {ComConsts.VersionGit}");
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue