diff --git a/examples/ExampleBrowser/CMakeLists.txt b/examples/ExampleBrowser/CMakeLists.txt index 4602046c5..edfa38828 100644 --- a/examples/ExampleBrowser/CMakeLists.txt +++ b/examples/ExampleBrowser/CMakeLists.txt @@ -85,8 +85,6 @@ SET(App_ExampleBrowser_SRCS ../Importers/ImportURDFDemo/URDF2Bullet.cpp ../Importers/ImportURDFDemo/MyMultiBodyCreator.cpp ../Importers/ImportURDFDemo/MyMultiBodyCreator.h - ../Importers/ImportURDFDemo/ROSURDFImporter.cpp - ../Importers/ImportURDFDemo/ROSURDFImporter.h ../Importers/ImportURDFDemo/UrdfParser.cpp ../Importers/ImportURDFDemo/urdfStringSplit.cpp ../Importers/ImportURDFDemo/urdfStringSplit.h @@ -141,6 +139,8 @@ SET(App_ExampleBrowser_SRCS ../ThirdPartyLibs/urdf/boost_replacement/string_split.h ../Utils/b3Clock.cpp ../Utils/b3Clock.h + ../Utils/b3ResourcePath.cpp + ../Utils/b3ResourcePath.h ${ExampleBrowser_SRCS} ${ExampleBrowser_HDRS} ${BULLET_PHYSICS_SOURCE_DIR}/build3/bullet.rc diff --git a/examples/ExampleBrowser/premake4.lua b/examples/ExampleBrowser/premake4.lua index 6e5762524..038e3b3eb 100644 --- a/examples/ExampleBrowser/premake4.lua +++ b/examples/ExampleBrowser/premake4.lua @@ -77,6 +77,7 @@ "../ThirdPartyLibs/Wavefront/tiny_obj_loader.*", "../ThirdPartyLibs/tinyxml/*", "../Utils/b3Clock.*", + "../Utils/b3ResourcePath.*", "../GyroscopicDemo/GyroscopicSetup.cpp", "../GyroscopicDemo/GyroscopicSetup.h", "../ThirdPartyLibs/urdf/urdfdom/urdf_parser/src/pose.cpp", diff --git a/examples/Importers/ImportColladaDemo/ImportColladaSetup.cpp b/examples/Importers/ImportColladaDemo/ImportColladaSetup.cpp index b9a967737..4b0292c74 100644 --- a/examples/Importers/ImportColladaDemo/ImportColladaSetup.cpp +++ b/examples/Importers/ImportColladaDemo/ImportColladaSetup.cpp @@ -24,6 +24,7 @@ subject to the following restrictions: #include "../OpenGLWindow/SimpleOpenGL3App.h" #include "LoadMeshFromCollada.h" #include "Bullet3Common/b3FileUtils.h" +#include "../../Utils/b3ResourcePath.h" #include "../CommonInterfaces/CommonRigidBodyBase.h" @@ -86,9 +87,9 @@ void ImportColladaSetup::initPhysics() char relativeFileName[1024]; - b3FileUtils f; - if (!f.findFile(fileName,relativeFileName,1024)) - return; + if (!b3ResourcePath::findResourcePath(fileName,relativeFileName,1024)) + return; + btVector3 shift(0,0,0); btVector3 scaling(1,1,1); @@ -209,4 +210,4 @@ void ImportColladaSetup::initPhysics() class CommonExampleInterface* ImportColladaCreateFunc(struct CommonExampleOptions& options) { return new ImportColladaSetup(options.m_guiHelper); -} \ No newline at end of file +} diff --git a/examples/Importers/ImportColladaDemo/LoadMeshFromCollada.cpp b/examples/Importers/ImportColladaDemo/LoadMeshFromCollada.cpp index f5b345ec4..317fe9c13 100644 --- a/examples/Importers/ImportColladaDemo/LoadMeshFromCollada.cpp +++ b/examples/Importers/ImportColladaDemo/LoadMeshFromCollada.cpp @@ -169,7 +169,7 @@ void readLibraryGeometries(TiXmlDocument& doc, btAlignedObjectArrayAttribute("semantic"); std::string semName(sem); // printf("sem=%s\n",sem); - const char* src = input->Attribute("source"); + // const char* src = input->Attribute("source"); // printf("src=%s\n",src); const char* srcIdRef = input->Attribute("source"); std::string source_name; @@ -192,12 +192,12 @@ void readLibraryGeometries(TiXmlDocument& doc, btAlignedObjectArrayQueryIntAttribute("count", &primitiveCount); - bool positionAndNormalInVertex=false; int indexStride=1; int posOffset = 0; int normalOffset = 0; int numIndices = 0; { + for (TiXmlElement* input = primitive->FirstChildElement("input");input != NULL;input = input->NextSiblingElement("input")) { const char* sem = input->Attribute("semantic"); @@ -206,7 +206,8 @@ void readLibraryGeometries(TiXmlDocument& doc, btAlignedObjectArrayindexStride) indexStride=offset+1; //printf("sem=%s\n",sem); - const char* src = input->Attribute("source"); + // const char* src = input->Attribute("source"); + //printf("src=%s\n",src); const char* srcIdRef = input->Attribute("source"); std::string source_name; @@ -226,7 +227,6 @@ void readLibraryGeometries(TiXmlDocument& doc, btAlignedObjectArraym_normalArrayId; normalOffset = offset; - positionAndNormalInVertex = true; } } if (semName=="NORMAL") @@ -234,7 +234,6 @@ void readLibraryGeometries(TiXmlDocument& doc, btAlignedObjectArray& name2Shap int* shapeIndexPtr = name2Shape[geomUrl]; if (shapeIndexPtr) { - int index = *shapeIndexPtr; + // int index = *shapeIndexPtr; printf("found geom with index %d\n", *shapeIndexPtr); ColladaGraphicsInstance& instance = visualShapeInstances.expand(); instance.m_shapeIndex = *shapeIndexPtr; @@ -555,7 +554,7 @@ void getUnitMeterScalingAndUpAxisTransform(TiXmlDocument& doc, btTransform& tr, void LoadMeshFromCollada(const char* relativeFileName, btAlignedObjectArray& visualShapes, btAlignedObjectArray& visualShapeInstances, btTransform& upAxisTransform, float& unitMeterScaling,int clientUpAxis) { - GLInstanceGraphicsShape* instance = 0; +// GLInstanceGraphicsShape* instance = 0; //usually COLLADA files don't have that many visual geometries/shapes visualShapes.reserve(32); @@ -745,4 +744,4 @@ void LoadMeshFromColladaAssimp(const char* relativeFileName, btAlignedObjectArra } -#endif //COMPARE_WITH_ASSIMP \ No newline at end of file +#endif //COMPARE_WITH_ASSIMP diff --git a/examples/Importers/ImportColladaDemo/btMatrix4x4.h b/examples/Importers/ImportColladaDemo/btMatrix4x4.h index 5d6ec3a30..0a71e86a8 100644 --- a/examples/Importers/ImportColladaDemo/btMatrix4x4.h +++ b/examples/Importers/ImportColladaDemo/btMatrix4x4.h @@ -117,7 +117,7 @@ ATTRIBUTE_ALIGNED16(class) btMatrix4x4 return m_el[0].w() * v.x() + m_el[1].w() * v.y() + m_el[2].w() * v.z() + m_el[3].w() * v.w(); } - SIMD_FORCE_INLINE btMatrix4x4 + SIMD_FORCE_INLINE btMatrix4x4 & operator*=(const btMatrix4x4& m) { setValue( @@ -125,6 +125,7 @@ ATTRIBUTE_ALIGNED16(class) btMatrix4x4 m.tdotx(m_el[1]), m.tdoty(m_el[1]), m.tdotz(m_el[1]),m.tdotw(m_el[1]), m.tdotx(m_el[2]), m.tdoty(m_el[2]), m.tdotz(m_el[2]),m.tdotw(m_el[2]), m.tdotx(m_el[3]), m.tdoty(m_el[3]), m.tdotz(m_el[3]),m.tdotw(m_el[3])); + return *this; } diff --git a/examples/Importers/ImportObjDemo/ImportObjExample.cpp b/examples/Importers/ImportObjDemo/ImportObjExample.cpp index bb13fda82..7b9444c5d 100644 --- a/examples/Importers/ImportObjDemo/ImportObjExample.cpp +++ b/examples/Importers/ImportObjDemo/ImportObjExample.cpp @@ -6,6 +6,8 @@ #include "btBulletDynamicsCommon.h" #include "../OpenGLWindow/SimpleOpenGL3App.h" #include "Wavefront2GLInstanceGraphicsShape.h" +#include "../../Utils/b3ResourcePath.h" +#include "Bullet3Common/b3FileUtils.h" #include "../CommonInterfaces/CommonRigidBodyBase.h" @@ -54,30 +56,17 @@ void ImportObjSetup::initPhysics() this->createEmptyDynamicsWorld(); m_guiHelper->createPhysicsDebugDrawer(m_dynamicsWorld); m_dynamicsWorld->getDebugDrawer()->setDebugMode(btIDebugDraw::DBG_DrawWireframe); - const char* fileName = "samurai_monastry.obj"; - char relativeFileName[1024]; - const char* prefix[]={"./data/","../data/","../../data/","../../../data/","../../../../data/"}; - int prefixIndex=-1; - { - - int numPrefixes = sizeof(prefix)/sizeof(char*); - - for (int i=0;i shapes; - std::string err = tinyobj::LoadObj(shapes, relativeFileName, prefix[prefixIndex]); + std::string err = tinyobj::LoadObj(shapes, relativeFileName, pathPrefix); GLInstanceGraphicsShape* gfxShape = btgCreateGraphicsShapeFromWavefrontObj(shapes); @@ -106,7 +95,12 @@ void ImportObjSetup::initPhysics() m_guiHelper->getRenderInterface()->registerGraphicsInstance(shapeId,position,orn,color,scaling); - } + }} + else + { + b3Warning("Cannot find %s\n", fileName); + } + } CommonExampleInterface* ImportObjCreateFunc(struct CommonExampleOptions& options) diff --git a/examples/Importers/ImportSTLDemo/ImportSTLSetup.cpp b/examples/Importers/ImportSTLDemo/ImportSTLSetup.cpp index 92996d9fe..b7f25c3dc 100644 --- a/examples/Importers/ImportSTLDemo/ImportSTLSetup.cpp +++ b/examples/Importers/ImportSTLDemo/ImportSTLSetup.cpp @@ -6,6 +6,7 @@ #include "../OpenGLWindow/SimpleOpenGL3App.h" #include "LoadMeshFromSTL.h" #include "../CommonInterfaces/CommonRigidBodyBase.h" +#include "../../Utils/b3ResourcePath.h" @@ -52,28 +53,12 @@ void ImportSTLSetup::initPhysics() const char* fileName = "l_finger_tip.stl"; char relativeFileName[1024]; - const char* prefix[]={"./data/","../data/","../../data/","../../../data/","../../../../data/"}; - int prefixIndex=-1; - { - - int numPrefixes = sizeof(prefix)/sizeof(char*); - - for (int i=0;i +#include "../../Utils/b3ResourcePath.h" @@ -101,7 +102,8 @@ bool BulletURDFImporter::loadURDF(const char* fileName) b3FileUtils fu; - bool fileFound = fu.findFile(fileName, relativeFileName, 1024); + //bool fileFound = fu.findFile(fileName, relativeFileName, 1024); + bool fileFound = b3ResourcePath::findResourcePath(fileName,relativeFileName,1024); std::string xml_string; m_data->m_pathPrefix[0] = 0; @@ -390,7 +392,7 @@ void convertURDFToVisualShape(const UrdfVisual* visual, const char* urdfPathPref upAxis); glmesh = new GLInstanceGraphicsShape; - int index = 0; + // int index = 0; glmesh->m_indices = new b3AlignedObjectArray(); glmesh->m_vertices = new b3AlignedObjectArray(); @@ -501,7 +503,7 @@ void convertURDFToVisualShape(const UrdfVisual* visual, const char* urdfPathPref glmesh = new GLInstanceGraphicsShape; - int index = 0; + // int index = 0; glmesh->m_indices = new b3AlignedObjectArray(); glmesh->m_vertices = new b3AlignedObjectArray(); @@ -702,7 +704,7 @@ btCollisionShape* convertURDFToCollisionShape(const UrdfCollision* collision, co upAxis ); glmesh = new GLInstanceGraphicsShape; - int index = 0; + // int index = 0; glmesh->m_indices = new b3AlignedObjectArray(); glmesh->m_vertices = new b3AlignedObjectArray(); diff --git a/examples/Importers/ImportURDFDemo/ImportURDFSetup.cpp b/examples/Importers/ImportURDFDemo/ImportURDFSetup.cpp index a4f633e68..ac4eadd84 100644 --- a/examples/Importers/ImportURDFDemo/ImportURDFSetup.cpp +++ b/examples/Importers/ImportURDFDemo/ImportURDFSetup.cpp @@ -9,7 +9,9 @@ #include "BulletDynamics/Featherstone/btMultiBodyJointMotor.h" #include "BulletDynamics/Featherstone/btMultiBodyDynamicsWorld.h" #include "../CommonInterfaces/CommonParameterInterface.h" +#ifdef ENABLE_ROS_URDF #include "ROSURDFImporter.h" +#endif #include "BulletUrdfImporter.h" @@ -197,18 +199,20 @@ void ImportUrdfSetup::initPhysics() //now print the tree using the new interface URDFImporterInterface* bla=0; - static bool newURDF = false; - newURDF = !newURDF; + static bool newURDF = true; if (newURDF) { b3Printf("using new URDF\n"); bla = new BulletURDFImporter(m_guiHelper); - } else + } +#ifdef USE_ROS_URDF + else { b3Printf("using ROS URDF\n"); bla = new ROSURDFImporter(m_guiHelper); } - + newURDF = !newURDF; +#endif//USE_ROS_URDF URDFImporterInterface& u2b = *bla; bool loadOk = u2b.loadURDF(m_fileName); diff --git a/examples/Importers/ImportURDFDemo/MyMultiBodyCreator.cpp b/examples/Importers/ImportURDFDemo/MyMultiBodyCreator.cpp index aa249d538..75b0fa212 100644 --- a/examples/Importers/ImportURDFDemo/MyMultiBodyCreator.cpp +++ b/examples/Importers/ImportURDFDemo/MyMultiBodyCreator.cpp @@ -12,8 +12,8 @@ #include "URDFJointTypes.h" MyMultiBodyCreator::MyMultiBodyCreator(GUIHelperInterface* guiHelper) - :m_guiHelper(guiHelper), - m_bulletMultiBody(0) + :m_bulletMultiBody(0), +m_guiHelper(guiHelper) { } diff --git a/examples/Importers/ImportURDFDemo/ROSURDFImporter.cpp b/examples/Importers/ImportURDFDemo/ROSURDFImporter.cpp index 5caa0e2f5..3c4a6daa4 100644 --- a/examples/Importers/ImportURDFDemo/ROSURDFImporter.cpp +++ b/examples/Importers/ImportURDFDemo/ROSURDFImporter.cpp @@ -152,7 +152,7 @@ bool ROSURDFImporter::loadURDF(const char* fileName) m_data->m_robot->getLinks(m_data->m_links); //initialize the 'index' of each link - for (int i=0;im_links.size();i++) + for (int i=0;i<(int)m_data->m_links.size();i++) { m_data->m_links[i]->m_link_index = i; } @@ -413,7 +413,7 @@ void ROSconvertURDFToVisualShape(const Visual* visual, const char* urdfPathPrefi upAxis); glmesh = new GLInstanceGraphicsShape; - int index = 0; + //int index = 0; glmesh->m_indices = new b3AlignedObjectArray(); glmesh->m_vertices = new b3AlignedObjectArray(); @@ -524,7 +524,7 @@ void ROSconvertURDFToVisualShape(const Visual* visual, const char* urdfPathPrefi glmesh = new GLInstanceGraphicsShape; - int index = 0; + // int index = 0; glmesh->m_indices = new b3AlignedObjectArray(); glmesh->m_vertices = new b3AlignedObjectArray(); @@ -726,7 +726,7 @@ btCollisionShape* convertURDFToCollisionShape(const Collision* visual, const cha upAxis ); glmesh = new GLInstanceGraphicsShape; - int index = 0; + // int index = 0; glmesh->m_indices = new b3AlignedObjectArray(); glmesh->m_vertices = new b3AlignedObjectArray(); diff --git a/examples/Importers/ImportURDFDemo/URDF2Bullet.cpp b/examples/Importers/ImportURDFDemo/URDF2Bullet.cpp index 0fcc3d1a9..2c1a2c0d0 100644 --- a/examples/Importers/ImportURDFDemo/URDF2Bullet.cpp +++ b/examples/Importers/ImportURDFDemo/URDF2Bullet.cpp @@ -73,9 +73,10 @@ void printTree(const URDFImporterInterface& u2b, int linkIndex, int indentationL struct URDF2BulletCachedData { URDF2BulletCachedData() - :m_totalNumJoints1(0), - m_currentMultiBodyLinkIndex(-1), - m_bulletMultiBody(0) + : + m_currentMultiBodyLinkIndex(-1), + m_bulletMultiBody(0), + m_totalNumJoints1(0) { } diff --git a/examples/Importers/ImportURDFDemo/UrdfParser.cpp b/examples/Importers/ImportURDFDemo/UrdfParser.cpp index f3feb0722..03563b719 100644 --- a/examples/Importers/ImportURDFDemo/UrdfParser.cpp +++ b/examples/Importers/ImportURDFDemo/UrdfParser.cpp @@ -18,7 +18,7 @@ static bool parseVector4(btVector4& vec4, const std::string& vector_str) btArray pieces; btArray rgba; urdfStringSplit(pieces, vector_str, urdfIsAnyOf(" ")); - for (unsigned int i = 0; i < pieces.size(); ++i) + for (int i = 0; i < pieces.size(); ++i) { if (!pieces[i].empty()) { @@ -39,7 +39,7 @@ static bool parseVector3(btVector3& vec3, const std::string& vector_str, ErrorLo btArray pieces; btArray rgba; urdfStringSplit(pieces, vector_str, urdfIsAnyOf(" ")); - for (unsigned int i = 0; i < pieces.size(); ++i) + for (int i = 0; i < pieces.size(); ++i) { if (!pieces[i].empty()) { @@ -844,4 +844,4 @@ bool UrdfParser::loadUrdf(const char* urdfText, ErrorLogger* logger) return initTreeAndRoot(logger); -} \ No newline at end of file +} diff --git a/examples/SharedMemory/PhysicsServer.cpp b/examples/SharedMemory/PhysicsServer.cpp index 6b05826da..83b660afb 100644 --- a/examples/SharedMemory/PhysicsServer.cpp +++ b/examples/SharedMemory/PhysicsServer.cpp @@ -4,7 +4,7 @@ #include "PosixSharedMemory.h" #include "Win32SharedMemory.h" -#include "../Importers/ImportURDFDemo/ROSURDFImporter.h" +#include "../Importers/ImportURDFDemo/BulletUrdfImporter.h" #include "../Importers/ImportURDFDemo/MyMultiBodyCreator.h" #include "../Importers/ImportURDFDemo/URDF2Bullet.h" @@ -132,7 +132,7 @@ bool PhysicsServer::loadUrdf(const char* fileName, const btVector3& pos, const b bool useMultiBody, bool useFixedBase) { - ROSURDFImporter u2b(m_guiHelper); + BulletURDFImporter u2b(m_guiHelper); bool loadOk = u2b.loadURDF(fileName); if (loadOk) { diff --git a/examples/SharedMemory/premake4.lua b/examples/SharedMemory/premake4.lua index 91ae0bd9f..2d9f28cc1 100644 --- a/examples/SharedMemory/premake4.lua +++ b/examples/SharedMemory/premake4.lua @@ -22,8 +22,9 @@ files { "../Importers/ImportURDFDemo/MultiBodyCreationInterface.h", "../Importers/ImportURDFDemo/MyMultiBodyCreator.cpp", "../Importers/ImportURDFDemo/MyMultiBodyCreator.h", - "../Importers/ImportURDFDemo/ROSURDFImporter.cpp", - "../Importers/ImportURDFDemo/ROSURDFImporter.h", + "../Importers/ImportURDFDemo/BulletUrdfImporter.cpp", + "../Importers/ImportURDFDemo/BulletUrdfImporter.h", + "../Importers/ImportURDFDemo/UrdfParser.cpp", "../Importers/ImportURDFDemo/BulletUrdfImporter.cpp", "../Importers/ImportURDFDemo/BulletUrdfImporter.h", "../Importers/ImportURDFDemo/urdfStringSplit.cpp", @@ -31,6 +32,7 @@ files { "../Importers/ImportURDFDemo/UrdfParser.h", "../Importers/ImportURDFDemo/URDF2Bullet.cpp", "../Importers/ImportURDFDemo/URDF2Bullet.h", + "../Utils/b3ResourcePath.cpp", "../Importers/ImportURDFDemo/URDFImporterInterface.h", "../Importers/ImportURDFDemo/URDFJointTypes.h", "../Importers/ImportObjDemo/Wavefront2GLInstanceGraphicsShape.cpp", diff --git a/examples/Utils/b3ResourcePath.cpp b/examples/Utils/b3ResourcePath.cpp new file mode 100644 index 000000000..75ca52415 --- /dev/null +++ b/examples/Utils/b3ResourcePath.cpp @@ -0,0 +1,80 @@ +#include "b3ResourcePath.h" +#include "Bullet3Common/b3Logging.h" +#ifdef __APPLE__ +#include /* _NSGetExecutablePath */ +#else +#ifdef _WIN32 +#else +//not Mac, not Windows, let's cross the fingers it is Linux :-) +#include +#endif +#endif + + +#include "Bullet3Common/b3FileUtils.h" +#define B3_MAX_EXE_PATH_LEN 4096 + +int b3ResourcePath::getExePath(char* path, int maxPathLenInBytes) +{ + int numBytes = 0; + +#if __APPLE__ + uint32_t bufsize = uint32_t(maxPathLenInBytes); + + if (_NSGetExecutablePath(path, &bufsize)!=0) + { + b3Warning("Cannot find executable path\n"); + return false; + } else + { + numBytes = strlen(path); + } +#else +#ifdef _WIN32 +#error not yet +#else + numBytes = (int)readlink("/proc/self/exe", path, maxPathLenInBytes-1); + if (numBytes > 0) + { + path[numBytes] = 0; + } else + { + b3Warning("Cannot find executable path\n"); + } +#endif //_WIN32 +#endif //__APPLE__ + + return numBytes; +} + +int b3ResourcePath::findResourcePath(const char* resourceName, char* resourcePath, int resourcePathMaxNumBytes) +{ + //first find in a resource/ location, then in various folders within 'data' using b3FileUtils + char exePath[B3_MAX_EXE_PATH_LEN]; + + int l = b3ResourcePath::getExePath(exePath, B3_MAX_EXE_PATH_LEN); + if (l) + { + char pathToExe[B3_MAX_EXE_PATH_LEN]; + + int exeNamePos = b3FileUtils::extractPath(exePath,pathToExe,B3_MAX_EXE_PATH_LEN); + if (exeNamePos) + { + sprintf(resourcePath,"%s../resources/%s/%s",pathToExe,&exePath[exeNamePos],resourceName); + //printf("try resource at %s\n", resourcePath); + if (b3FileUtils::findFile(resourcePath, resourcePath, resourcePathMaxNumBytes)) + { + return strlen(resourcePath); + } + } + } + + bool res = b3FileUtils::findFile(resourceName, resourcePath, resourcePathMaxNumBytes); + if (res) + { + return strlen(resourcePath); + } + + return 0; +} + diff --git a/examples/Utils/b3ResourcePath.h b/examples/Utils/b3ResourcePath.h new file mode 100644 index 000000000..32b168405 --- /dev/null +++ b/examples/Utils/b3ResourcePath.h @@ -0,0 +1,13 @@ +#ifndef _B3_RESOURCE_PATH_H +#define _B3_RESOURCE_PATH_H + +#include + +class b3ResourcePath +{ +public: + static int getExePath(char* path, int maxPathLenInBytes); + static int findResourcePath(const char* sourceName, char* resourcePath, int maxResourcePathLenInBytes); +}; +#endif + diff --git a/src/Bullet3Common/b3FileUtils.h b/src/Bullet3Common/b3FileUtils.h index 9a26f8c6b..1a331029e 100644 --- a/src/Bullet3Common/b3FileUtils.h +++ b/src/Bullet3Common/b3FileUtils.h @@ -15,7 +15,7 @@ struct b3FileUtils { } - bool findFile(const char* orgFileName, char* relativeFileName, int maxRelativeFileNameMaxLen) + static bool findFile(const char* orgFileName, char* relativeFileName, int maxRelativeFileNameMaxLen) { FILE* f=0; f = fopen(orgFileName,"rb"); @@ -33,7 +33,6 @@ struct b3FileUtils f=0; bool fileFound = false; - int result = 0; for (int i=0;!f && i0); if (maxPathLength>0) { - path[0] = 0; + path[len] = 0; } } + return len; } static char toLowerChar(const char t)