MCPcopy Create free account
hub / github.com/apache/singa / FindLastPathSeparator

Method FindLastPathSeparator

test/gtest/gtest-all.cc:7965–7976  ·  view source on GitHub ↗

Returns a pointer to the last occurence of a valid path separator in the FilePath. On Windows, for example, both '/' and '\' are valid path separators. Returns NULL if no path separator was found.

Source from the content-addressed store, hash-verified

7963// the FilePath. On Windows, for example, both '/' and '\' are valid path
7964// separators. Returns NULL if no path separator was found.
7965const char* FilePath::FindLastPathSeparator() const {
7966 const char* const last_sep = strrchr(c_str(), kPathSeparator);
7967#if GTEST_HAS_ALT_PATH_SEP_
7968 const char* const last_alt_sep = strrchr(c_str(), kAlternatePathSeparator);
7969 // Comparing two pointers of which only one is NULL is undefined.
7970 if (last_alt_sep != NULL &&
7971 (last_sep == NULL || last_alt_sep > last_sep)) {
7972 return last_alt_sep;
7973 }
7974#endif
7975 return last_sep;
7976}
7977
7978// Returns a copy of the FilePath with the directory part removed.
7979// Example: FilePath("path/to/file").RemoveDirectoryName() returns

Callers

nothing calls this directly

Calls 1

c_strFunction · 0.85

Tested by

no test coverage detected