utils.cpp
Go to the documentation of this file.
1 #include <string>
2 #include <cstddef>
3 
4 std::string GetFileName(const std::string& file_path)
5 {
6  char sep = '/';
7  size_t index = file_path.find_last_of(sep);
8  if (index == std::string::npos) {
9  return file_path;
10  }
11  return file_path.substr(index+1);
12 }
13 
14 std::string GenerateObjectKey(const std::string& file_path, const std::string& prefix)
15 {
16  std::string sep;
17  if (!prefix.empty() && prefix.back() != '/') {
18  sep = "/";
19  }
20  return prefix + sep + GetFileName(file_path);
21 }
std::string GetFileName(const std::string &file_path)
Definition: utils.cpp:4
std::string GenerateObjectKey(const std::string &file_path, const std::string &prefix)
Definition: utils.cpp:14


s3_common
Author(s): AWS RoboMaker
autogenerated on Tue Jun 1 2021 02:51:29