MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / MaybeAppendSlash

Function MaybeAppendSlash

tensorflow/core/platform/cloud/gcs_file_system.cc:181–189  ·  view source on GitHub ↗

Appends a trailing slash if the name doesn't already have one.

Source from the content-addressed store, hash-verified

179
180/// Appends a trailing slash if the name doesn't already have one.
181string MaybeAppendSlash(const string& name) {
182 if (name.empty()) {
183 return "/";
184 }
185 if (name.back() != '/') {
186 return strings::StrCat(name, "/");
187 }
188 return name;
189}
190
191// io::JoinPath() doesn't work in cases when we want an empty subpath
192// to result in an appended slash in order for directory markers

Callers 5

JoinGcsPathFunction · 0.85
FolderExistsMethod · 0.85
GetChildrenBoundedMethod · 0.85
CreateDirMethod · 0.85
DeleteDirMethod · 0.85

Calls 3

StrCatFunction · 0.50
emptyMethod · 0.45
backMethod · 0.45

Tested by

no test coverage detected