MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/OpenShadingLanguage / preprocess_file

Method preprocess_file

src/liboslcomp/oslcomp.cpp:152–174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

150
151
152bool
153OSLCompilerImpl::preprocess_file (const std::string &filename,
154 const std::string &stdoslpath,
155 const std::vector<std::string> &defines,
156 const std::vector<std::string> &includepaths,
157 std::string &result)
158{
159 // Read file contents into a string
160 std::ifstream instream;
161 OIIO::Filesystem::open(instream, filename);
162 if (! instream.is_open()) {
163 error (ustring(filename), 0, "Could not open \"%s\"\n", filename.c_str());
164 return false;
165 }
166
167 instream.unsetf (std::ios::skipws);
168 std::string instring (std::istreambuf_iterator<char>(instream.rdbuf()),
169 std::istreambuf_iterator<char>());
170 instream.close ();
171
172 return preprocess_buffer (instring, filename, stdoslpath, defines,
173 includepaths, result);
174}
175
176
177

Callers

nothing calls this directly

Calls 3

c_strMethod · 0.80
closeMethod · 0.80
errorFunction · 0.50

Tested by

no test coverage detected