fix various warning
add b3ResourcePath utility, to locate resources relative to executable
This commit is contained in:
@@ -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 && i<numPrefixes;i++)
|
||||
{
|
||||
@@ -64,7 +63,7 @@ struct b3FileUtils
|
||||
const char * oriptr;
|
||||
const char * patloc;
|
||||
// find how many times the pattern occurs in the original string
|
||||
for (oriptr = name; patloc = strstr(oriptr, pattern); oriptr = patloc + patlen)
|
||||
for (oriptr = name; (patloc = strstr(oriptr, pattern)); oriptr = patloc + patlen)
|
||||
{
|
||||
patcnt++;
|
||||
}
|
||||
@@ -73,7 +72,7 @@ struct b3FileUtils
|
||||
|
||||
|
||||
|
||||
static void extractPath(const char* fileName, char* path, int maxPathLength)
|
||||
static int extractPath(const char* fileName, char* path, int maxPathLength)
|
||||
{
|
||||
const char* stripped = strip2(fileName, "/");
|
||||
stripped = strip2(stripped, "\\");
|
||||
@@ -91,12 +90,14 @@ struct b3FileUtils
|
||||
path[len]=0;
|
||||
} else
|
||||
{
|
||||
len = 0;
|
||||
b3Assert(maxPathLength>0);
|
||||
if (maxPathLength>0)
|
||||
{
|
||||
path[0] = 0;
|
||||
path[len] = 0;
|
||||
}
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
static char toLowerChar(const char t)
|
||||
|
||||
Reference in New Issue
Block a user