added alternative paths, when files are not found

This commit is contained in:
ejcoumans
2006-09-20 03:19:27 +00:00
parent 93e145a4fc
commit 52a950db62
2 changed files with 22 additions and 4 deletions

View File

@@ -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 () ) ;
}
}

View File

@@ -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 */