also allow absolute path in asset files (.obj, .stl, .dae etc)

This commit is contained in:
Erwin Coumans
2017-03-14 10:40:27 -07:00
parent bbefc8fe7e
commit 3d2cb1cabf

View File

@@ -512,19 +512,32 @@ bool findExistingMeshFile(
shorter.reverse(); shorter.reverse();
std::string existing_file; std::string existing_file;
for (std::list<std::string>::iterator x=shorter.begin(); x!=shorter.end(); ++x)
{ {
std::string attempt = *x + "/" + fn; std::string attempt = fn;
FILE* f = fopen(attempt.c_str(), "rb"); FILE* f = fopen(attempt.c_str(), "rb");
if (!f) if (f)
{ {
//b3Printf("%s: tried '%s'", error_message_prefix.c_str(), attempt.c_str()); existing_file = attempt;
continue; fclose(f);
}
}
if (existing_file.empty())
{
for (std::list<std::string>::iterator x=shorter.begin(); x!=shorter.end(); ++x)
{
std::string attempt = *x + "/" + fn;
FILE* f = fopen(attempt.c_str(), "rb");
if (!f)
{
//b3Printf("%s: tried '%s'", error_message_prefix.c_str(), attempt.c_str());
continue;
}
fclose(f);
existing_file = attempt;
//b3Printf("%s: found '%s'", error_message_prefix.c_str(), attempt.c_str());
break;
} }
fclose(f);
existing_file = attempt;
//b3Printf("%s: found '%s'", error_message_prefix.c_str(), attempt.c_str());
break;
} }
if (existing_file.empty()) if (existing_file.empty())