[Bf-committers] PATCH: If yafray is not in /usr/local/bin blender will not find
it...
Panagiotis Papadakos
bf-committers@blender.org
Thu, 29 Jan 2004 10:35:34 +0200 (EET)
In source/blender/yafray/intern/export_File.cpp, statement
if(stat(alternative[i],&st)<0) continue;
will always be false for alternative[0] which is /usr/local/bin
and so it will return /usr/local/bin as the path of yafray executable.
The following patch should fix this. Sorry it's C since I didn't know
how to get const char* from string fp. (Just a type-cast)?
--- source/blender/yafray/intern/export_File.cpp_old 2004-01-29
09:45:25.000000000 +0000
+++ source/blender/yafray/intern/export_File.cpp 2004-01-29
10:35:05.000000000 +0000
@@ -79,6 +79,7 @@
static string unixYafrayPath()
{
+ char * fp = NULL;
static char *alternative[]=
{
"/usr/local/bin/",
@@ -89,10 +90,21 @@
for(int i=0;alternative[i]!=NULL;++i)
{
- string fp=string(alternative[i])+"yafray";
struct stat st;
- if(stat(alternative[i],&st)<0) continue;
- if(st.st_mode&S_IXOTH) return alternative[i];
+
+ fp = strdup(alternative[i]);
+ fp = strcat(fp,"yafray");
+
+ if(stat(fp,&st)<0)
+ {
+ free(fp);
+ continue;
+ }
+ if(st.st_mode&S_IXOTH)
+ {
+ free(p);
+ return alternative[i];
+ }
}
return "";
}
Panagiotis Papadakos