In Collada: exporter path parsing improved

pull/261/head
Léo Terziman 2013-12-05 18:13:17 +01:00
parent 54e4c6b20b
commit 3dc62f22fb
1 changed files with 3 additions and 9 deletions

View File

@ -61,19 +61,13 @@ void ExportSceneCollada(const char* pFile,IOSystem* pIOSystem, const aiScene* pS
{
std::string path = "";
const char* end_path = strrchr(pFile, '/');
if(end_path != NULL) {
path = std::string(pFile, end_path + 1 - pFile);
} else {
// We need to test both types of folder separators because pIOSystem->getOsSeparator() is not reliable.
// Moreover, the path given by some applications is not even consistent with the OS specific type of separator.
end_path = strrchr(pFile, '\\');
const char* end_path = std::max(strrchr(pFile, '\\'), strrchr(pFile, '/'));
if(end_path != NULL) {
path = std::string(pFile, end_path + 1 - pFile);
}
}
// invoke the exporter
ColladaExporter iDoTheExportThing( pScene, pIOSystem, path);