about summary refs log tree commit diff
path: root/absl/flags
diff options
context:
space:
mode:
Diffstat (limited to 'absl/flags')
-rw-r--r--absl/flags/parse_test.cc16
1 files changed, 10 insertions, 6 deletions
diff --git a/absl/flags/parse_test.cc b/absl/flags/parse_test.cc
index 447a3bc7bdcb..f89fa96527b7 100644
--- a/absl/flags/parse_test.cc
+++ b/absl/flags/parse_test.cc
@@ -22,6 +22,7 @@
 #include "absl/base/internal/raw_logging.h"
 #include "absl/base/internal/scoped_set_env.h"
 #include "absl/flags/flag.h"
+#include "absl/strings/match.h"
 #include "absl/strings/str_cat.h"
 #include "absl/strings/substitute.h"
 #include "absl/types/span.h"
@@ -92,8 +93,11 @@ const std::string& GetTestTempDir() {
 
       auto len = GetTempPathA(MAX_PATH, temp_path_buffer);
       if (len < MAX_PATH && len != 0) {
-        std::string temp_dir_name = absl::StrCat(
-            temp_path_buffer, "\\parse_test.", GetCurrentProcessId());
+        std::string temp_dir_name = temp_path_buffer;
+        if (!absl::EndsWith(temp_dir_name, "\\")) {
+          temp_dir_name.push_back('\\');
+        }
+        absl::StrAppend(&temp_dir_name, "parse_test.", GetCurrentProcessId());
         if (CreateDirectoryA(temp_dir_name.c_str(), nullptr)) {
           *res = temp_dir_name;
         }
@@ -104,11 +108,11 @@ const std::string& GetTestTempDir() {
         *res = unique_name;
       }
 #endif
+    }
 
-      if (res->empty()) {
-        ABSL_INTERNAL_LOG(FATAL,
-                          "Failed to make temporary directory for data files");
-      }
+    if (res->empty()) {
+      ABSL_INTERNAL_LOG(FATAL,
+                        "Failed to make temporary directory for data files");
     }
 
 #ifdef _WIN32