fix windows build for b3ResourcePath
replace print -> b3Printf in URDF2Bullet.cpp
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include <mach-o/dyld.h> /* _NSGetExecutablePath */
|
||||
#else
|
||||
#ifdef _WIN32
|
||||
#include <Windows.h>
|
||||
#else
|
||||
//not Mac, not Windows, let's cross the fingers it is Linux :-)
|
||||
#include <unistd.h>
|
||||
@@ -31,8 +32,11 @@ int b3ResourcePath::getExePath(char* path, int maxPathLenInBytes)
|
||||
}
|
||||
#else
|
||||
#ifdef _WIN32
|
||||
#error not yet
|
||||
//https://msdn.microsoft.com/en-us/library/windows/desktop/ms683197(v=vs.85).aspx
|
||||
HMODULE hModule = GetModuleHandle(NULL);
|
||||
numBytes = GetModuleFileName(hModule, path, maxPathLenInBytes);
|
||||
#else
|
||||
///http://stackoverflow.com/questions/933850/how-to-find-the-location-of-the-executable-in-c
|
||||
numBytes = (int)readlink("/proc/self/exe", path, maxPathLenInBytes-1);
|
||||
if (numBytes > 0)
|
||||
{
|
||||
@@ -60,12 +64,19 @@ int b3ResourcePath::findResourcePath(const char* resourceName, char* resourcePat
|
||||
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);
|
||||
}
|
||||
sprintf(resourcePath,"%s../data/%s",pathToExe,resourceName);
|
||||
//printf("try resource at %s\n", resourcePath);
|
||||
if (b3FileUtils::findFile(resourcePath, resourcePath, resourcePathMaxNumBytes))
|
||||
{
|
||||
return strlen(resourcePath);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user