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

Function getDirectoryName

Libraries/Testing/Testing.cpp:197–211  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

195}
196
197static Result getDirectoryName(StringSpan path, StringPath& directory)
198{
199 const native_char_t* text = path.getNullTerminatedNative();
200 const size_t length = nativeLength(path);
201 size_t last = length;
202 while (last > 0)
203 {
204 if (isSeparator(text[last - 1]))
205 {
206 return assignNativeSlice(directory, text, last - 1);
207 }
208 last--;
209 }
210 return Result::Error("Missing directory separator");
211}
212
213static bool pathViewEquals(StringSpan lhs, StringSpan rhs)
214{

Callers 3

resolveLibraryRootFunction · 0.85

Calls 4

nativeLengthFunction · 0.85
isSeparatorFunction · 0.85
assignNativeSliceFunction · 0.85
ErrorEnum · 0.50

Tested by

no test coverage detected