Added file list in filesystem

This commit is contained in:
Xiao Qi 2022-09-24 13:36:09 +08:00
parent 225c247a85
commit cb73a8c5d1
2 changed files with 24 additions and 0 deletions

View File

@ -80,6 +80,12 @@ namespace SHADE
{
if (!dirEntry.is_directory())
{
folder->files.emplace_back(
dirEntry.path().filename().string(),
dirEntry.path().string(),
dirEntry.path().extension().string()
);
continue;
}
@ -103,6 +109,11 @@ namespace SHADE
}
}
FolderPointer SHFileSystem::GetRoot() noexcept
{
return root;
}
FolderPointer SHFileSystem::CreateFolder(FolderPath path, FolderLocation parent, FolderHandle location, FolderName name) noexcept
{
assert(

View File

@ -14,12 +14,22 @@ namespace SHADE
typedef uint64_t FolderLocation;
typedef uint64_t FolderHandle;
typedef std::string FolderName;
typedef std::string FileName;
typedef std::string FolderPath;
typedef std::string FilePath;
typedef std::string FileExt;
typedef SHFolder* FolderPointer;
constexpr char FOLDER_BIT_ALLOCATE{ 4 };
constexpr char FOLDER_MAX_DEPTH{ 16 };
struct SHFile
{
FileName name;
FilePath path;
FileExt ext;
};
class SHFolder
{
public:
@ -28,6 +38,7 @@ namespace SHADE
FolderHandle id;
FolderName name;
std::vector<FolderPointer> subFolders;
std::vector<SHFile> files;
bool folded;
@ -45,6 +56,8 @@ namespace SHADE
static void StartupFillDirectories(FolderPath path) noexcept;
static FolderPointer GetRoot() noexcept;
private:
static FolderPointer root;