MCPcopy Create free account
hub / github.com/csyonghe/Spire / TryToFindIncludeFile

Method TryToFindIncludeFile

Source/SpireLib/SpireLib.cpp:175–200  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

173 List<String> searchDirs;
174
175 virtual bool TryToFindIncludeFile(
176 CoreLib::String const& pathToInclude,
177 CoreLib::String const& pathIncludedFrom,
178 CoreLib::String* outFoundPath,
179 CoreLib::String* outFoundSource) override
180 {
181 String path = Path::Combine(Path::GetDirectoryName(pathIncludedFrom), pathToInclude);
182 if (File::Exists(path))
183 {
184 *outFoundPath = path;
185 *outFoundSource = File::ReadAllText(path);
186 return true;
187 }
188
189 for (auto & dir : searchDirs)
190 {
191 path = Path::Combine(dir, pathToInclude);
192 if (File::Exists(path))
193 {
194 *outFoundPath = path;
195 *outFoundSource = File::ReadAllText(path);
196 return true;
197 }
198 }
199 return false;
200 }
201
202 };
203

Callers 1

HandleIncludeDirectiveFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected