You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "lidavidm (via GitHub)" <gi...@apache.org> on 2023/05/04 17:18:54 UTC
[GitHub] [arrow] lidavidm commented on a diff in pull request #34420: GH-34386: [C++] Add a PathFromUriOrPath method
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: github-unsubscribe@arrow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org