mirror of
https://github.com/recastnavigation/recastnavigation.git
synced 2026-08-16 16:19:55 +00:00
Convert file IO to use FileIO class in SampleInterfaces.h
de-duping a lot of standard file IO
This commit is contained in:
@@ -136,13 +136,22 @@ static char* parseRow(char* buf, char* bufEnd, char* row, int len)
|
||||
|
||||
bool InputGeom::loadMesh(rcContext* ctx, const std::string& filepath)
|
||||
{
|
||||
char* buffer;
|
||||
size_t bufferLen;
|
||||
if (!tryReadFile(filepath, &buffer, &bufferLen))
|
||||
FileIO file;
|
||||
if (!file.openForRead(filepath.c_str()))
|
||||
{
|
||||
ctx->log(RC_LOG_ERROR, "buildTiledNavigation: Could not load '%s'", filepath.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t bufferLen = file.getFileSize();
|
||||
char* buffer = new char[bufferLen];
|
||||
|
||||
if (!file.read(buffer, bufferLen))
|
||||
{
|
||||
ctx->log(RC_LOG_ERROR, "buildTiledNavigation: Could not load '%s'", filepath.c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
filename = filepath;
|
||||
|
||||
delete chunkyMesh;
|
||||
|
||||
Reference in New Issue
Block a user