lidavidm commented on code in PR #34420:
URL: https://github.com/apache/arrow/pull/34420#discussion_r1185297533
##########
cpp/src/arrow/filesystem/path_util.cc:
##########
@@ -129,7 +129,17 @@ std::string EnsureLeadingSlash(std::string_view v) {
return std::string(v);
}
}
-std::string_view RemoveTrailingSlash(std::string_view key) {
+std::string_view RemoveTrailingSlash(std::string_view key, bool preserve_root)
{
+ if (preserve_root && key.size() == 1) {
+ // If the user gives us "/" then don't return ""
+ return key;
+ }
+#ifdef _WIN32
+ if (preserve_root && key.size() == 3 && key[1] == ':' && key[0] != '/') {
+ // If the user gives us C:/ then don't return C:
+ return key;
+ }
+#endif
Review Comment:
Oh fun.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]