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

Method MakeFileName

test/gtest/gtest-all.cc:8012–8024  ·  view source on GitHub ↗

Given directory = "dir", base_name = "test", number = 0, extension = "xml", returns "dir/test.xml". If number is greater than zero (e.g., 12), returns "dir/test_12.xml". On Windows platform, uses \ as the separator rather than /.

Source from the content-addressed store, hash-verified

8010// than zero (e.g., 12), returns "dir/test_12.xml".
8011// On Windows platform, uses \ as the separator rather than /.
8012FilePath FilePath::MakeFileName(const FilePath& directory,
8013 const FilePath& base_name,
8014 int number,
8015 const char* extension) {
8016 std::string file;
8017 if (number == 0) {
8018 file = base_name.string() + "." + extension;
8019 } else {
8020 file = base_name.string() + "_" + StreamableToString(number)
8021 + "." + extension;
8022 }
8023 return ConcatPaths(directory, FilePath(file));
8024}
8025
8026// Given directory = "dir", relative_path = "test.xml", returns "dir/test.xml".
8027// On Windows, uses \ as the separator rather than /.

Callers

nothing calls this directly

Calls 2

StreamableToStringFunction · 0.85
FilePathFunction · 0.85

Tested by

no test coverage detected