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

Function pathJoin

Libraries/Testing/Testing.cpp:133–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

131}
132
133static Result pathJoin(StringPath& output, StringSpan base, StringSpan leaf)
134{
135 SC_TRY(output.assign(base));
136 trimTrailingSeparators(output);
137 const size_t length = nativeLength(output.view());
138 if (length > 0)
139 {
140 native_char_t separatorBuffer[2] = {NativeSeparator, 0};
141 const bool needsSeparator = !isSeparator(output.writableSpan().data()[length - 1]);
142 if (needsSeparator)
143 {
144 SC_TRY(output.append(nativeSpan(separatorBuffer, 1, true)));
145 }
146 }
147 SC_TRY(output.append(leaf));
148 return Result(true);
149}
150
151static bool pathExistsFile(StringSpan path)
152{

Callers 2

repoHasMarkersFunction · 0.85

Calls 10

trimTrailingSeparatorsFunction · 0.85
nativeLengthFunction · 0.85
isSeparatorFunction · 0.85
nativeSpanFunction · 0.85
writableSpanMethod · 0.80
ResultClass · 0.50
assignMethod · 0.45
viewMethod · 0.45
dataMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected