ReXGlue SDK
Loading...
Searching...
No Matches
rex::filesystem::IFileSystem Class Referenceabstract

#include <rex/filesystem/file_system.h>

Inheritance diagram for rex::filesystem::IFileSystem:
[legend]

Public Member Functions

virtual Result< void > Mount (const MountEntry &entry)=0
virtual Result< void > Unmount (std::string_view path)=0
virtual std::vector< MountEntry > GetMounts () const =0
virtual Result< void > Link (std::string_view link, std::string_view target)=0
virtual Result< void > Unlink (std::string_view link)=0
virtual std::optional< std::string > FindLink (std::string_view path) const =0
virtual Result< void > ConfigureStandardMounts (const std::filesystem::path &game_root, const std::filesystem::path &update_root, MountFlags game_flags)=0
virtual void Clear ()=0
virtual Result< Opened > Open (std::string_view path, const OpenOptions &options)=0
virtual Result< Opened > OpenRelative (IFile &root, std::string_view path, const OpenOptions &options)=0
virtual Result< FileStat > Stat (std::string_view path)=0
virtual Result< std::unique_ptr< IDirectory > > List (std::string_view path, std::string_view pattern)=0
virtual Result< void > CreateDirectories (std::string_view path)=0
virtual Result< void > Remove (std::string_view path)=0
virtual Result< void > Rename (std::string_view from, std::string_view to, bool replace_existing)=0
virtual Result< void > Rename (IFile &file, std::string_view to, bool replace_existing, IFile *root=nullptr)=0
virtual Result< VolumeStat > GetVolume (std::string_view path)=0

Additional Inherited Members

Protected Member Functions inherited from rex::NonCopyable
 NonCopyable (const NonCopyable &)=delete
NonCopyable & operator= (const NonCopyable &)=delete

Detailed Description

The mount table guest paths resolve through. The first matching mount owns a path.

Member Function Documentation

◆ Clear()

virtual void rex::filesystem::IFileSystem::Clear ( )
pure virtual

Removes every mount and every link.

◆ ConfigureStandardMounts()

virtual Result< void > rex::filesystem::IFileSystem::ConfigureStandardMounts ( const std::filesystem::path & game_root,
const std::filesystem::path & update_root,
MountFlags game_flags )
nodiscardpure virtual

Replaces the table with the standard game, update and Harddisk0 mounts.

Parameters
game_rootThe host folder of the game files.
update_rootThe host folder of the title update files, empty for none.
Returns
kNotFound when game_root is empty or not a folder.

◆ CreateDirectories()

virtual Result< void > rex::filesystem::IFileSystem::CreateDirectories ( std::string_view path)
nodiscardpure virtual

Creates a directory and every missing parent.

Returns
Ok when the directory exists after the call, kAccessDenied on a read only mount.

◆ FindLink()

virtual std::optional< std::string > rex::filesystem::IFileSystem::FindLink ( std::string_view path) const
nodiscardpure virtual

Returns the target of the first link that is a prefix of path, case insensitive, empty when no link matches.

◆ GetVolume()

virtual Result< VolumeStat > rex::filesystem::IFileSystem::GetVolume ( std::string_view path)
nodiscardpure virtual

Returns the volume of the mount that owns a path, or kNoMount.

◆ Link()

virtual Result< void > rex::filesystem::IFileSystem::Link ( std::string_view link,
std::string_view target )
nodiscardpure virtual

Adds a link.

Returns
kExists when the name is taken.

◆ List()

virtual Result< std::unique_ptr< IDirectory > > rex::filesystem::IFileSystem::List ( std::string_view path,
std::string_view pattern )
nodiscardpure virtual

Starts a walk of the children of a directory.

Parameters
patternThe wildcard pattern, empty for every child.
Returns
The walk, kPathNotFound, kNotFound or kNotDirectory.

◆ Mount()

virtual Result< void > rex::filesystem::IFileSystem::Mount ( const MountEntry & entry)
nodiscardpure virtual

Appends a mount.

Returns
kMountExists for a taken path, kNotFound for a missing source, kCorrupt for a bad container.

◆ Open()

virtual Result< Opened > rex::filesystem::IFileSystem::Open ( std::string_view path,
const OpenOptions & options )
nodiscardpure virtual

Opens or creates a file or directory.

Parameters
optionsDisposition, access and type.
Returns
The file and the action, kPathNotFound when a folder of the path is missing or is a file, kNotFound when a disposition that needs the file finds none. A write request on a read only mount gets read access.

◆ OpenRelative()

virtual Result< Opened > rex::filesystem::IFileSystem::OpenRelative ( IFile & root,
std::string_view path,
const OpenOptions & options )
nodiscardpure virtual

Opens or creates a file or directory relative to an open directory.

Parameters
optionsDisposition, access and type.
Returns
The file and the action, or the error.

◆ Remove()

virtual Result< void > rex::filesystem::IFileSystem::Remove ( std::string_view path)
nodiscardpure virtual

Deletes a file, or a directory with its contents.

Returns
kPathNotFound, kNotFound, or kAccessDenied for a mount root or a read only mount.

◆ Rename() [1/2]

virtual Result< void > rex::filesystem::IFileSystem::Rename ( IFile & file,
std::string_view to,
bool replace_existing,
IFile * root = nullptr )
nodiscardpure virtual

Moves an open file or directory inside its mount.

Parameters
toThe new path. A bare name with no root stays in the folder of the file.
replace_existingTrue to replace a closed file at the new path.
rootAn open directory the new path is relative to, or null.
Returns
kPathNotFound, kNotFound, kExists, kNotSameDevice, kInvalidPath, kAccessDenied, or the provider error.

◆ Rename() [2/2]

virtual Result< void > rex::filesystem::IFileSystem::Rename ( std::string_view from,
std::string_view to,
bool replace_existing )
nodiscardpure virtual

Moves a file or directory inside its mount.

Parameters
toThe new guest path, resolved through links and mounts.
replace_existingTrue to replace a closed file at the new path.
Returns
kPathNotFound, kNotFound, kExists, kNotSameDevice, kInvalidPath, kAccessDenied, or the provider error.

◆ Stat()

virtual Result< FileStat > rex::filesystem::IFileSystem::Stat ( std::string_view path)
nodiscardpure virtual

Returns the information of a path without opening it, kNoMount, kPathNotFound or kNotFound.

◆ Unlink()

virtual Result< void > rex::filesystem::IFileSystem::Unlink ( std::string_view link)
nodiscardpure virtual

Removes a link, case insensitive.

Returns
kNotFound when no link has the name.

◆ Unmount()

virtual Result< void > rex::filesystem::IFileSystem::Unmount ( std::string_view path)
nodiscardpure virtual

Removes the mount with exactly this path. Its open files must be closed first.

Returns
kNoMount when no mount has the path.

The documentation for this class was generated from the following file: