@@ -769,13 +769,19 @@ TEST_CASE("invalid-face-definition", "[face]") {
|
||||
}
|
||||
|
||||
TEST_CASE("Empty mtl basedir", "[Issue177]") {
|
||||
// Win32 spesific?
|
||||
tinyobj::attrib_t attrib;
|
||||
std::vector<tinyobj::shape_t> shapes;
|
||||
std::vector<tinyobj::material_t> materials;
|
||||
|
||||
std::string err;
|
||||
bool ret = tinyobj::LoadObj(&attrib, &shapes, &materials, &err, "issue-177.obj");
|
||||
|
||||
// A case where the user explicitly provides an empty string
|
||||
// Win32 specific?
|
||||
const char * userBaseDir = "";
|
||||
bool ret = tinyobj::LoadObj(&attrib, &shapes, &materials, &err, "issue-177.obj", userBaseDir);
|
||||
|
||||
// if mtl loading fails, we get an error message (WARN) here
|
||||
ret &= err.empty();
|
||||
|
||||
if (!err.empty()) {
|
||||
std::cerr << "[Issue177] " << err << std::endl;
|
||||
|
||||
@@ -1736,9 +1736,8 @@ bool LoadObj(attrib_t *attrib, std::vector<shape_t> *shapes,
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string baseDir;
|
||||
if (mtl_basedir) {
|
||||
baseDir = mtl_basedir;
|
||||
std::string baseDir = mtl_basedir ? mtl_basedir : "";
|
||||
if (!baseDir.empty()) {
|
||||
#ifndef _WIN32
|
||||
const char dirsep = '/';
|
||||
#else
|
||||
|
||||
Reference in New Issue
Block a user