28 File(std::filesystem::path path);
35 std::filesystem::path
getPath()
const;
88 std::filesystem::path
getPath()
const;
102 std::vector<std::shared_ptr<File>>
getFiles()
const;
123 static void setRoot(std::shared_ptr<Directory> root);
130 static std::shared_ptr<Directory>
getRoot();
138 static std::shared_ptr<File>
getFile(std::filesystem::path path);
142 std::vector<std::shared_ptr<File>>
_files;
146 static std::map<std::filesystem::path, std::shared_ptr<File>>
_mapFiles;
A class representing a directory in the filesystem.
Definition: Filesystem.hpp:62
static std::map< std::filesystem::path, std::shared_ptr< File > > _mapFiles
Map of file paths to file objects.
Definition: Filesystem.hpp:146
std::vector< std::shared_ptr< File > > getFiles() const
Get a list of files within this directory.
Definition: Filesystem.cpp:47
std::filesystem::path _path
The path to the directory.
Definition: Filesystem.hpp:141
std::vector< std::shared_ptr< Directory > > _directories
List of subdirectories in the directory.
Definition: Filesystem.hpp:143
static std::shared_ptr< File > getFile(std::filesystem::path path)
Get a file by its path from the filesystem.
Definition: Filesystem.cpp:72
static std::shared_ptr< Directory > _rootDirectory
The root directory of the filesystem.
Definition: Filesystem.hpp:145
std::vector< std::shared_ptr< File > > _files
List of files in the directory.
Definition: Filesystem.hpp:142
Directory(std::filesystem::path path)
Constructor for a Directory object.
Definition: Filesystem.cpp:24
void update()
Update the content of the directory by listing subdirectories and files.
Definition: Filesystem.cpp:26
static void setRoot(std::shared_ptr< Directory > root)
Set the root directory of the filesystem.
Definition: Filesystem.cpp:69
std::vector< std::shared_ptr< Directory > > getSubDirectories() const
Get a list of subdirectories within this directory.
Definition: Filesystem.cpp:46
static std::shared_ptr< Directory > getRoot()
Get the root directory of the filesystem.
Definition: Filesystem.cpp:70
std::string getName() const
Get the name of the directory.
Definition: Filesystem.cpp:44
void createFile(std::string name)
Create a new file within this directory.
Definition: Filesystem.cpp:59
void createDirectory(std::string name)
Create a new subdirectory within this directory.
Definition: Filesystem.cpp:49
std::filesystem::path getPath() const
Get the path to the directory.
Definition: Filesystem.cpp:45
A class representing a file in the filesystem.
Definition: Filesystem.hpp:21
FILE_TYPE getType() const
Get the type of the file.
Definition: Filesystem.cpp:22
std::string getNameWithoutExtension() const
Definition: Filesystem.cpp:21
std::filesystem::path getPath() const
Get the path to the file.
Definition: Filesystem.cpp:19
std::filesystem::path _path
The path to the file.
Definition: Filesystem.hpp:54
File(std::filesystem::path path)
Constructor for a File object.
Definition: Filesystem.cpp:8
FILE_TYPE _type
The type of the file.
Definition: Filesystem.hpp:55
std::string getName() const
Get the name of the file, including the extension.
Definition: Filesystem.cpp:20
FILE_TYPE
An enumeration representing file types.
Definition: Filesystem.hpp:15
@ IMAGE
Definition: Filesystem.hpp:15
@ OTHER
Definition: Filesystem.hpp:15
@ PYTHON
Definition: Filesystem.hpp:15