Refactor tracing
This commit is contained in:
@@ -5,7 +5,7 @@ namespace Copium
|
||||
std::vector<char> FileSystem::ReadFile(const std::string& filename)
|
||||
{
|
||||
std::ifstream file(filename, std::ios::ate | std::ios::binary);
|
||||
CP_ASSERT(file.is_open(), "ReadFile : Failed to open file");
|
||||
CP_ASSERT(file.is_open(), "Failed to open file");
|
||||
|
||||
size_t fileSize = (size_t)file.tellg();
|
||||
std::vector<char> buffer(fileSize);
|
||||
@@ -19,10 +19,10 @@ namespace Copium
|
||||
std::vector<uint32_t> FileSystem::ReadFile32(const std::string& filename)
|
||||
{
|
||||
std::ifstream file(filename, std::ios::ate | std::ios::binary);
|
||||
CP_ASSERT(file.is_open(), "ReadFile32 : Failed to open file");
|
||||
CP_ASSERT(file.is_open(), "Failed to open file");
|
||||
|
||||
size_t fileSize = (size_t)file.tellg();
|
||||
CP_ASSERT(fileSize % 4 == 0, "ReadFile32 : byte size is not divisible by 4");
|
||||
CP_ASSERT(fileSize % 4 == 0, "byte size is not divisible by 4");
|
||||
std::vector<uint32_t> buffer(fileSize / 4);
|
||||
|
||||
file.seekg(0);
|
||||
@@ -34,7 +34,7 @@ namespace Copium
|
||||
std::string FileSystem::ReadFileStr(const std::string& filename)
|
||||
{
|
||||
std::ifstream file(filename, std::ios::ate | std::ios::binary);
|
||||
CP_ASSERT(file.is_open(), "ReadFileStr : Failed to open file");
|
||||
CP_ASSERT(file.is_open(), "Failed to open file");
|
||||
|
||||
size_t fileSize = (size_t)file.tellg();
|
||||
std::string buffer;
|
||||
@@ -51,7 +51,7 @@ namespace Copium
|
||||
std::filesystem::path path{filename};
|
||||
std::filesystem::create_directories(path.parent_path());
|
||||
std::ofstream file(filename, std::ios::binary);
|
||||
CP_ASSERT(file.is_open(), "WriteFile : Failed to open file");
|
||||
CP_ASSERT(file.is_open(), "Failed to open file");
|
||||
|
||||
file.write(data.c_str(), data.size());
|
||||
}
|
||||
@@ -61,7 +61,7 @@ namespace Copium
|
||||
std::filesystem::path path{filename};
|
||||
std::filesystem::create_directories(path.parent_path());
|
||||
std::ofstream file(filename, std::ios::binary);
|
||||
CP_ASSERT(file.is_open(), "WriteFile : Failed to open file");
|
||||
CP_ASSERT(file.is_open(), "Failed to open file");
|
||||
|
||||
file.write(data, size);
|
||||
}
|
||||
@@ -75,7 +75,7 @@ namespace Copium
|
||||
int64_t FileSystem::DateModified(const std::string& filename)
|
||||
{
|
||||
struct stat result;
|
||||
CP_ASSERT(stat(filename.c_str(), &result) == 0, "DataModified : Cannot stat file %s", filename.c_str());
|
||||
CP_ASSERT(stat(filename.c_str(), &result) == 0, "Cannot stat file %s", filename.c_str());
|
||||
return (int64_t)result.st_mtime;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user