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

Method RemoveFileName

tests/gtest/gtest-all.cc:9399–9408  ·  view source on GitHub ↗

RemoveFileName returns the directory path with the filename removed. Example: FilePath("path/to/file").RemoveFileName() returns "path/to/". If the FilePath is "a_file" or "/a_file", RemoveFileName returns FilePath("./") or, on Windows, FilePath(".\\"). If the filepath does not have a file, like "just/a/dir/", it returns the FilePath unmodified. On Windows platform, '\' is the path separator, other

Source from the content-addressed store, hash-verified

9397// not have a file, like "just/a/dir/", it returns the FilePath unmodified.
9398// On Windows platform, '\' is the path separator, otherwise it is '/'.
9399FilePath FilePath::RemoveFileName() const {
9400 const char* const last_sep = FindLastPathSeparator();
9401 std::string dir;
9402 if (last_sep) {
9403 dir = std::string(c_str(), static_cast<size_t>(last_sep + 1 - c_str()));
9404 } else {
9405 dir = kCurrentDirectoryString;
9406 }
9407 return FilePath(dir);
9408}
9409
9410// Helper functions for naming files in a directory for xml output.
9411

Callers 2

OpenFileForWritingFunction · 0.80

Calls 2

c_strFunction · 0.85
FilePathFunction · 0.85

Tested by

no test coverage detected