Skip to content

Commit

Permalink
[Emscripten, FileSystem]: Enabled building of tests for Emscripten
Browse files Browse the repository at this point in the history
  • Loading branch information
MikhailGorobets committed Jan 6, 2024
1 parent 68362a8 commit 33cb902
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-emscripten.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
uses: DiligentGraphics/github-action/configure-cmake@v1
with:
build-type: ${{ matrix.build_type }}
cmake-args: "-DDILIGENT_BUILD_CORE_INCLUDE_TEST=ON"
cmake-args: "-DDILIGENT_BUILD_CORE_TESTS=ON"

- name: Build
if: success()
Expand Down
10 changes: 8 additions & 2 deletions Platforms/Emscripten/interface/EmscriptenFileSystem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,16 @@ struct EmscriptenFileSystem : public BasicFileSystem
static bool PathExists(const Char* strPath);

static bool CreateDirectory(const Char* strPath);
static void ClearDirectory(const Char* strPath);
static void ClearDirectory(const Char* strPath, bool Recursive = false);
static void DeleteFile(const Char* strPath);
static bool DeleteDirectory(const Char* strPath);
static bool IsDirectory(const Char* strPath);

static std::vector<std::unique_ptr<FindFileData>> Search(const Char* SearchPattern);
static SearchFilesResult Search(const Char* SearchPattern);
static SearchFilesResult SearchRecursive(const Char* Dir, const Char* SearchPattern);

static std::string GetCurrentDirectory();
static std::string GetLocalAppDataDirectory(const char* AppName = nullptr, bool Create = true);
};

} // namespace Diligent
41 changes: 37 additions & 4 deletions Platforms/Emscripten/src/EmscriptenFileSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,12 @@
#include <unistd.h>
#include <cstdio>


#include "EmscriptenFileSystem.hpp"
#include "Errors.hpp"
#include "DebugUtilities.hpp"
//#include "DebugUtilities.hpp"
#include "../../Common/interface/StringTools.hpp"
#include "../../Basic/include/SearchRecursive.inl"

namespace Diligent
{
Expand Down Expand Up @@ -73,7 +76,7 @@ bool EmscriptenFileSystem::CreateDirectory(const Char* strPath)
return false;
}

void EmscriptenFileSystem::ClearDirectory(const Char* strPath)
void EmscriptenFileSystem::ClearDirectory(const Char* strPath, bool Recursive)
{
UNSUPPORTED("Not implemented");
}
Expand All @@ -83,10 +86,40 @@ void EmscriptenFileSystem::DeleteFile(const Char* strPath)
remove(strPath);
}

std::vector<std::unique_ptr<FindFileData>> EmscriptenFileSystem::Search(const Char* SearchPattern)
bool EmscriptenFileSystem::DeleteDirectory(const Char* strPath)
{
UNSUPPORTED("Not implemented");
return false;
}

bool EmscriptenFileSystem::IsDirectory(const Char* strPath)
{
UNSUPPORTED("Not implemented");
return false;
}

EmscriptenFileSystem::SearchFilesResult EmscriptenFileSystem::Search(const Char* SearchPattern)
{
UNSUPPORTED("Not implemented");
return EmscriptenFileSystem::SearchFilesResult{};
}

EmscriptenFileSystem::SearchFilesResult EmscriptenFileSystem::SearchRecursive(const Char* Dir, const Char* SearchPattern)
{
UNSUPPORTED("Not implemented");
return EmscriptenFileSystem::SearchFilesResult{};
}

std::string EmscriptenFileSystem::GetCurrentDirectory()
{
UNSUPPORTED("Not implemented");
return std::string();
}

std::string EmscriptenFileSystem::GetLocalAppDataDirectory(const char* AppName, bool Create)
{
UNSUPPORTED("Not implemented");
return std::vector<std::unique_ptr<FindFileData>>();
return std::string();
}

} // namespace Diligent
2 changes: 2 additions & 0 deletions Tests/DiligentCoreAPITest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ endif()

if(NOT ARCHIVER_SUPPORTED)
list(REMOVE_ITEM SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/src/ArchiveTest.cpp)
list(REMOVE_ITEM SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/src/GenerateArchiveDotNetTest.cpp)
list(REMOVE_ITEM SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/src/RenderStateCacheTest.cpp)
endif()

if(D3D11_SUPPORTED)
Expand Down

0 comments on commit 33cb902

Please sign in to comment.