MCPcopy Create free account
hub / github.com/apache/arrow / RemoveTrailingSlash

Function RemoveTrailingSlash

cpp/src/arrow/filesystem/path_util.cc:180–195  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

178 }
179}
180std::string_view RemoveTrailingSlash(std::string_view key, bool preserve_root) {
181 if (preserve_root && key.size() == 1) {
182 // If the user gives us "/" then don't return ""
183 return key;
184 }
185#ifdef _WIN32
186 if (preserve_root && key.size() == 3 && key[1] == ':' && key[0] != '/') {
187 // If the user gives us C:/ then don't return C:
188 return key;
189 }
190#endif
191 while (!key.empty() && key.back() == kSep) {
192 key.remove_suffix(1);
193 }
194 return key;
195}
196
197std::string_view RemoveLeadingSlash(std::string_view key) {
198 while (!key.empty() && key.front() == kSep) {

Callers 15

GetFileInfoMethod · 0.70
CreateDirOnFileSystemMethod · 0.70
DeleteDirOnFileSystemMethod · 0.70
AcquireBlobLeaseMethod · 0.70
DeleteFileOnContainerMethod · 0.70
MovePathWithDataLakeAPIFunction · 0.70
FromUriMethod · 0.70
FileSystemFromUriOrPathFunction · 0.70
FromUriMethod · 0.70

Calls 3

backMethod · 0.80
sizeMethod · 0.45
emptyMethod · 0.45

Tested by 4

TESTFunction · 0.56
CleanupDirectoryNamesMethod · 0.56
CheckExpectedErrnoMethod · 0.56
AssertAfterMoveMethod · 0.56