MCPcopy Create free account
hub / github.com/comaps/comaps / GetDirectory

Function GetDirectory

libs/base/file_name_utils.cpp:46–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44}
45
46string GetDirectory(string const & name)
47{
48 auto const sep = GetNativeSeparator();
49 size_t const sepSize = sizeof(sep);
50
51 string::size_type i = name.rfind(sep);
52 if (i == string::npos)
53 return ".";
54 while (i > sepSize && (name[i - sepSize] == sep))
55 i -= sepSize;
56 return name.substr(0, i ? i : sepSize);
57}
58
59string::value_type GetNativeSeparator()
60{

Callers 3

UNIT_TESTFunction · 0.85
MakeTemporaryMethod · 0.85

Calls 1

GetNativeSeparatorFunction · 0.85

Tested by 1

UNIT_TESTFunction · 0.68