diff --git a/CMakeLists.txt b/CMakeLists.txt index 05d5b4e..94ab6c7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -69,7 +69,6 @@ SET ( protot_SRCS src/shaderc_hlsl.cpp src/RuntimeModuleManager.cc - # src/Serializer.cc 3rdparty/glfw/deps/glad.c ) diff --git a/src/Serializer.h b/src/Serializer.h index d528d04..a850368 100644 --- a/src/Serializer.h +++ b/src/Serializer.h @@ -5,7 +5,7 @@ #include #include #include - +#include struct WriteSerializer { enum { IsReading = 0 }; @@ -71,13 +71,19 @@ struct ReadSerializer { } void Open(const char* filename) { + // early out if file does not (yet) exist + struct stat fstat; + if (stat(filename, &fstat) == -1) { + return; + } + std::ifstream stream(filename, std::ios::binary); + size_t key_size; size_t block_size; while (!stream.eof()) { - // read key size stream.read(reinterpret_cast(&key_size), sizeof(size_t)); std::cout << "read key size " << key_size << std::endl;