From 8fd9f6e57bf8c70d5ae47cf0f0d1bf1ccae2dfc2 Mon Sep 17 00:00:00 2001 From: silverweed Date: Fri, 1 Jun 2018 12:02:38 +0200 Subject: [PATCH] ensure mtl_basedir ends with a directory separator --- tiny_obj_loader.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tiny_obj_loader.h b/tiny_obj_loader.h index fbb31b17..9e43a7dd 100644 --- a/tiny_obj_loader.h +++ b/tiny_obj_loader.h @@ -1155,7 +1155,7 @@ static bool exportFaceGroupToShape(shape_t *shape, // ??? continue; } - + size_t ovi = size_t( remainingFace.vertex_indices[idx] .v_idx); @@ -1739,6 +1739,13 @@ bool LoadObj(attrib_t *attrib, std::vector *shapes, std::string baseDir; if (mtl_basedir) { baseDir = mtl_basedir; +#ifndef _WIN32 + const char dirsep = '/'; +#else + const char dirsep = '\\'; +#endif + if (baseDir[baseDir.length() - 1] != dirsep) + baseDir += dirsep; } MaterialFileReader matFileReader(baseDir);