MCPcopy Create free account
hub / github.com/Pagghiu/SaneCppLibraries / normalizeRelativePathForCompileDefine

Function normalizeRelativePathForCompileDefine

Tools/SC-build.cpp:258–276  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

256}
257
258static Result normalizeRelativePathForCompileDefine(String& path)
259{
260 const StringView pathView = path.view();
261 String normalized = StringEncoding::Utf8;
262 auto builder = StringBuilder::create(normalized);
263 for (size_t idx = 0; idx < pathView.sizeInBytes(); ++idx)
264 {
265 char ch = pathView.bytesWithoutTerminator()[idx];
266 if (ch == '\\')
267 {
268 ch = '/';
269 }
270 const char character[] = {ch, 0};
271 SC_TRY(builder.append(StringView::fromNullTerminated(character, StringEncoding::Utf8)));
272 }
273 builder.finalize();
274 path = move(normalized);
275 return Result(true);
276}
277
278static Result addCompiledLibraryRootDefine(Project& project, const Parameters& parameters)
279{

Callers 2

Calls 7

createFunction · 0.85
fromNullTerminatedFunction · 0.85
ResultClass · 0.50
viewMethod · 0.45
sizeInBytesMethod · 0.45
appendMethod · 0.45
finalizeMethod · 0.45

Tested by

no test coverage detected