the problem is caused by
... ...
string fn = component + "/" + filename;
... ...
The filename variable contains the name of the plugin, and the component variable contains one component of search paths, which are specified in PBRT_SEARCHPATH. When you have a path in PBRT_SEARCHPATH like
c:\pbrt-1.03
Suppose the content of filename variable is mitchell.dll, then the fn becomes
c:\pbrt-1.03/mitchell.dll
which can be correctly found.
But in windows system, when you have a space in the path name, you have to use " " to enclose the path, e.g.
"c:\Program Files\pbrt-1.03"
if you add a path like this to PBRT_SEARCHPATH, then the fn becomes
"c:\Program Files\pbrt-1.03"/mitchell.dll
which can NOT be found by the Windows system, though you have given the correct path and file name.
(From mantis bug tracker)
There's a small function named SearchPath in dynload.cpp
static string SearchPath(const string &searchpath, const string &filename) { const char _start = searchpath.c_str(); const char end = start; while (_start) { while (end && *end != PBRT_PATH_SEP[0]) ++end; string component(start, end);
string fn = component + "/" + filename;
FILE _f = fopen(fn.c_str(), "r"); if (f) { fclose(f); return fn; } if (_end == PBRT_PATH_SEP[0]) ++end; start = end; } return "";
}
the problem is caused by ... ... string fn = component + "/" + filename; ... ...
The filename variable contains the name of the plugin, and the component variable contains one component of search paths, which are specified in PBRT_SEARCHPATH. When you have a path in PBRT_SEARCHPATH like
c:\pbrt-1.03
Suppose the content of filename variable is mitchell.dll, then the fn becomes
c:\pbrt-1.03/mitchell.dll
which can be correctly found.
But in windows system, when you have a space in the path name, you have to use " " to enclose the path, e.g.
"c:\Program Files\pbrt-1.03"
if you add a path like this to PBRT_SEARCHPATH, then the fn becomes
"c:\Program Files\pbrt-1.03"/mitchell.dll
which can NOT be found by the Windows system, though you have given the correct path and file name.