Filesystem - Actual filesystem operations

* Entry type, directory listing
 * Directory creation and deletion
 * File deletion
 * Move
This commit is contained in:
Emmanuel BENOîT 2018-12-23 22:29:56 +01:00
parent 3ef6dcd55e
commit 68716e9193
2 changed files with 288 additions and 7 deletions
include/ebcl

View file

@ -201,6 +201,15 @@ M_LSHIFT_OP( T_StringBuilder , T_FSPath const& );
/*= FILESYSTEM ===============================================================*/
// Type of entries
enum class E_FSEntryType {
NONE , // Filesystem entry does not exist
FILE , // Filesystem entry refers to a file
DIRECTORY , // Filesystem entry refers to a directory
OTHER // Filesystem entry exists but refers to something else
// entirely (e.g. symlinks) and is therefore off-limits
};
class Filesystem final
{
Filesystem( ) = delete;
@ -208,6 +217,29 @@ class Filesystem final
// Return the absolute path to the current working directory
static T_FSPath Cwd( ) noexcept;
// Get the type of an entry
static E_FSEntryType TypeOf( T_FSPath const& path ) noexcept;
// List a directory's contents
static bool List( T_FSPath const& path ,
T_Array< T_String >& output ) noexcept;
// Create a new directory
static bool MkDir( T_FSPath const& path ) noexcept;
// Create a new directory, including parent directories if
// they do not exist
static bool MkDirFull( T_FSPath const& path ) noexcept;
// Delete a directory
static bool RmDir( T_FSPath const& path ) noexcept;
// Delete a file
static bool Rm( T_FSPath const& path ) noexcept;
// Move or rename a file
static bool Move( T_FSPath const& from ,
T_FSPath const& to ) noexcept;
};