added alternative paths, when files are not found
This commit is contained in:
@@ -431,11 +431,11 @@ void initCubeVBO ()
|
||||
{
|
||||
//the filenames have additional path to make it easier for some platforms
|
||||
if ( noVertexTextureSupport )
|
||||
cubeShader = new GLSL_ShaderPair ( "CubeShader", "../../Extras/GPUphysics/cubeShaderNoTexture.vert",
|
||||
"../../Extras/GPUphysics/cubeShader.frag" ) ;
|
||||
cubeShader = new GLSL_ShaderPair ( "CubeShader", "cubeShaderNoTexture.vert",
|
||||
"cubeShader.frag" ) ;
|
||||
else
|
||||
cubeShader = new GLSL_ShaderPair ( "CubeShader", "../../Extras/GPUphysics/cubeShader.vert",
|
||||
"../../Extras/GPUphysics/cubeShader.frag" ) ;
|
||||
cubeShader = new GLSL_ShaderPair ( "CubeShader", "cubeShader.vert",
|
||||
"cubeShader.frag" ) ;
|
||||
assert ( cubeShader -> compiledOK () ) ;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,6 +51,24 @@ static char *readShaderText ( const char *fname )
|
||||
|
||||
|
||||
FILE *fd = fopen ( fname, "r" ) ;
|
||||
if (!fd)
|
||||
{
|
||||
//some platforms might require different path, try two additional locations
|
||||
char newname[256];
|
||||
sprintf(newname,"../../Extras/GPUphysics/%s",fname);
|
||||
fd = fopen( newname ,"r");
|
||||
if (!fd)
|
||||
{
|
||||
sprintf("Extras/GPUphysics/%s",fname);
|
||||
fd = fopen( newname,"r");
|
||||
}
|
||||
}
|
||||
|
||||
if (!fd)
|
||||
{
|
||||
printf("cannot open file %s\n",fname);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int size = 0;
|
||||
/* File operations denied? ok, just close and return failure */
|
||||
|
||||
Reference in New Issue
Block a user