From 3dc62f22fb7f5ef9b9059dfb9a8040262560d639 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Terziman?= Date: Thu, 5 Dec 2013 18:13:17 +0100 Subject: [PATCH] In Collada: exporter path parsing improved --- code/ColladaExporter.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/code/ColladaExporter.cpp b/code/ColladaExporter.cpp index 11faaaab9..ea21f9e73 100644 --- a/code/ColladaExporter.cpp +++ b/code/ColladaExporter.cpp @@ -61,18 +61,12 @@ void ExportSceneCollada(const char* pFile,IOSystem* pIOSystem, const aiScene* pS { std::string path = ""; - const char* end_path = strrchr(pFile, '/'); + // 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. + const char* end_path = std::max(strrchr(pFile, '\\'), 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, '\\'); - - if(end_path != NULL) { - path = std::string(pFile, end_path + 1 - pFile); - } } // invoke the exporter