diff --git a/SHADE_Engine/src/Filesystem/SHFileSystem.cpp b/SHADE_Engine/src/Filesystem/SHFileSystem.cpp index 16175578..bd34ed71 100644 --- a/SHADE_Engine/src/Filesystem/SHFileSystem.cpp +++ b/SHADE_Engine/src/Filesystem/SHFileSystem.cpp @@ -2,7 +2,6 @@ #include "SHFileSystem.h" #include "fileapi.h" #include -#include #include namespace SHADE @@ -27,8 +26,11 @@ namespace SHADE } auto const count = static_cast(folders[here]->subFolders.size()); - - assert(count < FOLDER_MAX_COUNT, "Max subfolders reached\n"); + + if (count >= FOLDER_MAX_COUNT) + { + SHLOG_ERROR("Max subfolder reached: {}\n", name); + } auto const location = static_cast(count); @@ -37,7 +39,10 @@ namespace SHADE return location; } - assert(folders.contains(here), "Folder creation location does not exist/invalid\n"); + if (!folders.contains(here)) + { + SHLOG_ERROR("Folder creation location does not exist/invalid: {}\n", here); + } auto const count = static_cast(folders[here]->subFolders.size()); @@ -45,7 +50,11 @@ namespace SHADE location <<= FOLDER_BIT_ALLOCATE; location |= count; - assert(count < FOLDER_MAX_COUNT, "Max subfolders reached\n"); + if (count >= FOLDER_MAX_COUNT) + { + SHLOG_ERROR("Max subfolder reached: {}\n", name); + } + CreateFolder(folders[0]->path, here, location, name); return location; @@ -53,7 +62,10 @@ namespace SHADE bool SHFileSystem::DeleteFolder(FolderPointer location) noexcept { - assert(folders.contains(location->id), "Delete target does not exist/invalid.\n"); + if (!folders.contains(location->id)) + { + SHLOG_ERROR("Delete target does not exist/invalid: {}\n", location->name); + } for (auto const& subFolder : folders[location->id]->subFolders) { @@ -116,10 +128,11 @@ namespace SHADE FolderPointer SHFileSystem::CreateFolder(FolderPath path, FolderLocation parent, FolderHandle location, FolderName name) noexcept { - assert( - CreateDirectoryA(path.c_str(), nullptr), - "Failed to create folder\n" - ); + + if (!CreateDirectoryA(path.c_str(), nullptr)) + { + SHLOG_ERROR("Failed to create folder: {}\n", path); + } folders[location] = std::make_unique(location, name); folders[location]->path = path;