MCPcopy Create free account
hub / github.com/Kitware/CMake / RemoveTrailingSlashes

Function RemoveTrailingSlashes

Source/kwsys/SystemTools.cxx:3031–3052  ·  view source on GitHub ↗

Remove any trailing slash from the name except in a root component.

Source from the content-addressed store, hash-verified

3029
3030// Remove any trailing slash from the name except in a root component.
3031static char const* RemoveTrailingSlashes(
3032 std::string const& inName, char (&local_buffer)[KWSYS_SYSTEMTOOLS_MAXPATH],
3033 std::string& string_buffer)
3034{
3035 size_t length = inName.size();
3036 char const* name = inName.c_str();
3037
3038 size_t last = length - 1;
3039 if (last > 0 && (name[last] == '/' || name[last] == '\\') &&
3040 strcmp(name, "/") != 0 && name[last - 1] != ':') {
3041 if (last < sizeof(local_buffer)) {
3042 memcpy(local_buffer, name, last);
3043 local_buffer[last] = '\0';
3044 name = local_buffer;
3045 } else {
3046 string_buffer.append(name, last);
3047 name = string_buffer.c_str();
3048 }
3049 }
3050
3051 return name;
3052}
3053
3054bool SystemTools::FileIsDirectory(std::string const& inName)
3055{

Callers 2

FileIsDirectoryMethod · 0.85
FileIsExecutableMethod · 0.85

Calls 3

c_strMethod · 0.80
appendMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…