A class representing a directory in the filesystem.
More...
#include <Filesystem.hpp>
|
static void | setRoot (std::shared_ptr< Directory > root) |
| Set the root directory of the filesystem. More...
|
|
static std::shared_ptr< Directory > | getRoot () |
| Get the root directory of the filesystem. More...
|
|
static std::shared_ptr< File > | getFile (std::filesystem::path path) |
| Get a file by its path from the filesystem. More...
|
|
A class representing a directory in the filesystem.
◆ Directory()
shkyera::Directory::Directory |
( |
std::filesystem::path |
path | ) |
|
Constructor for a Directory object.
- Parameters
-
path | The path to the directory. |
◆ createDirectory()
void shkyera::Directory::createDirectory |
( |
std::string |
name | ) |
|
Create a new subdirectory within this directory.
- Parameters
-
name | The name of the new subdirectory. |
◆ createFile()
void shkyera::Directory::createFile |
( |
std::string |
name | ) |
|
Create a new file within this directory.
- Parameters
-
name | The name of the new file. |
◆ getFile()
std::shared_ptr< File > shkyera::Directory::getFile |
( |
std::filesystem::path |
path | ) |
|
|
static |
Get a file by its path from the filesystem.
- Parameters
-
path | The path to the file. |
- Returns
- The shared pointer to the file.
◆ getFiles()
std::vector< std::shared_ptr< File > > shkyera::Directory::getFiles |
( |
| ) |
const |
Get a list of files within this directory.
- Returns
- A vector of shared pointers to files.
◆ getName()
std::string shkyera::Directory::getName |
( |
| ) |
const |
Get the name of the directory.
- Returns
- The name of the directory.
◆ getPath()
std::filesystem::path shkyera::Directory::getPath |
( |
| ) |
const |
Get the path to the directory.
- Returns
- The path to the directory.
◆ getRoot()
std::shared_ptr< Directory > shkyera::Directory::getRoot |
( |
| ) |
|
|
static |
Get the root directory of the filesystem.
- Returns
- The shared pointer to the root directory.
◆ getSubDirectories()
std::vector< std::shared_ptr< Directory > > shkyera::Directory::getSubDirectories |
( |
| ) |
const |
Get a list of subdirectories within this directory.
- Returns
- A vector of shared pointers to subdirectories.
◆ setRoot()
void shkyera::Directory::setRoot |
( |
std::shared_ptr< Directory > |
root | ) |
|
|
static |
Set the root directory of the filesystem.
- Parameters
-
root | The shared pointer to the root directory. |
◆ update()
void shkyera::Directory::update |
( |
| ) |
|
Update the content of the directory by listing subdirectories and files.
◆ _directories
std::vector<std::shared_ptr<Directory> > shkyera::Directory::_directories |
|
private |
List of subdirectories in the directory.
◆ _files
std::vector<std::shared_ptr<File> > shkyera::Directory::_files |
|
private |
List of files in the directory.
◆ _mapFiles
std::map< std::filesystem::path, std::shared_ptr< File > > shkyera::Directory::_mapFiles = {} |
|
staticprivate |
Map of file paths to file objects.
◆ _path
std::filesystem::path shkyera::Directory::_path |
|
private |
The path to the directory.
◆ _rootDirectory
std::shared_ptr< Directory > shkyera::Directory::_rootDirectory = nullptr |
|
staticprivate |
The root directory of the filesystem.
The documentation for this class was generated from the following files: