vibhatha commented on code in PR #13401:
URL: https://github.com/apache/arrow/pull/13401#discussion_r965601278


##########
cpp/src/arrow/util/io_util.cc:
##########
@@ -1867,7 +1867,16 @@ Result<std::unique_ptr<TemporaryDir>> 
TemporaryDir::Make(const std::string& pref
       [&](const NativePathString& base_dir) -> 
Result<std::unique_ptr<TemporaryDir>> {
     Status st;
     for (int attempt = 0; attempt < 3; ++attempt) {
-      PlatformFilename fn(base_dir + kNativeSep + base_name + kNativeSep);
+      // Note: certain temporary directories of MacOS contains a trailing slash
+      // Handling the base_dir with trailing slash
+      PlatformFilename fn;
+      if (base_dir.back() == kNativeSep) {
+        PlatformFilename fn_base_dir(base_dir);
+        PlatformFilename fn_base_name(base_name + kNativeSep);
+        fn = fn_base_dir.Join(fn_base_name);
+      } else {
+        fn = PlatformFilename(base_dir + kNativeSep + base_name + kNativeSep);
+      }

Review Comment:
   Yes it did. Because the case ignores adding an additional `kNativeSep` when 
it is already there, in the else it adds if it isn't there. Although, it is 
pretty simple just do what you suggest. Sorry I didn't catch this. 



-- 
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-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to