This commit is contained in:
Booklordofthedings 2024-08-11 23:01:48 +02:00
parent 568e00c770
commit bee75d00e1
5 changed files with 98 additions and 1 deletions

6
BeefProj.toml Normal file
View file

@ -0,0 +1,6 @@
FileVersion = 1
[Project]
Name = "Prop-Room"
TargetType = "BeefLib"
StartupObject = "Prop_Room.Program"

5
BeefSpace.toml Normal file
View file

@ -0,0 +1,5 @@
FileVersion = 1
Projects = {Prop-Room = {Path = "."}}
[Workspace]
StartupProject = "Prop-Room"

View file

@ -1,3 +1,3 @@
# Prop-Room
File system abstraction layer
Mount single file containers into your application

22
src/IMountable.bf Normal file
View file

@ -0,0 +1,22 @@
namespace Prop_Room;
using System;
interface IMountable
{
///File methods
public bool FileExists(StringView pFilePath); ///Returns true if a file exists and false if it does not exists or it cannot be accessed
public Result<void> FileDelete(StringView pFilePath); ///Delete a file if it exists, if it does not exist or cannot be deleted returns an Error
public Result<void> FileCreate(StringView pFilePath); ///Create an empty file, and returns an error if the file could not be created. If the file already exists return okay, but dont change any of the file contents
public Result<void> FileCopy(StringView pOriginPath, StringView pTargetPath); ///Copy a file from the origin path to the target path
public Result<void> FileMove(StringView pOriginPath, StringView pTargetPath); ///Move a file from the origin path to the target path. Return an error if it failed
public Result<void> FileReadText(StringView pFilePath, String pBuffer); ///Read the content of the file into the output buffer and error if it failed
//Directory methods
public bool DirectoryExists(StringView pDirPath); ///Returns true if a dir exists and false if it does not exists or it cannot be accessed
public Result<void> DirectoryDelete(StringView pDirPath); ///Recursivly delete a dir if it exists, if it does not exist or cannot be deleted returns an Error
public Result<void> DirectoryCreate(StringView pDirPath); ///Create an empty dir, and returns an error if the dir could not be created. If the dir already exists return okay
public Result<void> DirectoryCopy(StringView pOriginPath, StringView pTargetPath); ///Recursivly copy a directory and all files and directories it contains to the target path
public Result<void> DirectoryMove(StringView pOriginPath, StringView pTargetPath); ///Recursivly move a directory from the origin path to the target path. Return an error if it failed
}

View file

@ -0,0 +1,64 @@
namespace Prop_Room.Implementations;
using Prop_Room;
using System;
using System.IO;
class FileSystem : IMountable
{
public bool FileExists(StringView pFilePath)
{
return default;
}
public Result<void> FileDelete(StringView pFilePath)
{
return default;
}
public Result<void> FileCreate(StringView pFilePath)
{
return default;
}
public Result<void> FileCopy(StringView pOriginPath, StringView pTargetPath)
{
return default;
}
public Result<void> FileMove(StringView pOriginPath, StringView pTargetPath)
{
return default;
}
public Result<void> FileReadText(StringView pFilePath, String pBuffer)
{
return default;
}
public bool DirectoryExists(StringView pDirPath)
{
return default;
}
public Result<void> DirectoryDelete(StringView pDirPath)
{
return default;
}
public Result<void> DirectoryCreate(StringView pDirPath)
{
return default;
}
public Result<void> DirectoryCopy(StringView pOriginPath, StringView pTargetPath)
{
return default;
}
public Result<void> DirectoryMove(StringView pOriginPath, StringView pTargetPath)
{
return default;
}
}