MCPcopy Create free account
hub / github.com/awslabs/aws-lambda-cpp / FindLastPathSeparator

Method FindLastPathSeparator

tests/gtest/gtest-all.cc:9369–9380  ·  view source on GitHub ↗

Returns a pointer to the last occurrence 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

9367// the FilePath. On Windows, for example, both '/' and '\' are valid path
9368// separators. Returns NULL if no path separator was found.
9369const char* FilePath::FindLastPathSeparator() const {
9370 const char* const last_sep = strrchr(c_str(), kPathSeparator);
9371#if GTEST_HAS_ALT_PATH_SEP_
9372 const char* const last_alt_sep = strrchr(c_str(), kAlternatePathSeparator);
9373 // Comparing two pointers of which only one is NULL is undefined.
9374 if (last_alt_sep != nullptr &&
9375 (last_sep == nullptr || last_alt_sep > last_sep)) {
9376 return last_alt_sep;
9377 }
9378#endif
9379 return last_sep;
9380}
9381
9382// Returns a copy of the FilePath with the directory part removed.
9383// Example: FilePath("path/to/file").RemoveDirectoryName() returns

Callers

nothing calls this directly

Calls 1

c_strFunction · 0.85

Tested by

no test coverage detected