MCPcopy Create free account
hub / github.com/OpenPTrack/open_ptrack_v2 / RemoveFileName

Method RemoveFileName

rtpose_wrapper/src/gtest/gtest-all.cpp:7586–7595  ·  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

7584// not have a file, like "just/a/dir/", it returns the FilePath unmodified.
7585// On Windows platform, '\' is the path separator, otherwise it is '/'.
7586FilePath FilePath::RemoveFileName() const {
7587 const char* const last_sep = FindLastPathSeparator();
7588 String dir;
7589 if (last_sep) {
7590 dir = String(c_str(), last_sep + 1 - c_str());
7591 } else {
7592 dir = kCurrentDirectoryString;
7593 }
7594 return FilePath(dir);
7595}
7596
7597// Helper functions for naming files in a directory for xml output.
7598

Callers 2

OnTestIterationEndMethod · 0.80

Calls 3

c_strFunction · 0.85
FilePathFunction · 0.85
StringFunction · 0.70

Tested by

no test coverage detected