Index: base/files/scoped_temp_dir.cc |
diff --git a/base/files/scoped_temp_dir.cc b/base/files/scoped_temp_dir.cc |
index 26815217c6b46f07ab9540c349df33d2a726c898..a04e825156b6d1be7af531d38813f978a32be1d0 100644 |
--- a/base/files/scoped_temp_dir.cc |
+++ b/base/files/scoped_temp_dir.cc |
@@ -9,6 +9,13 @@ |
namespace base { |
+namespace { |
+ |
+constexpr FilePath::CharType kScopedDirPrefix[] = |
+ FILE_PATH_LITERAL("scoped_dir"); |
+ |
+} // namespace |
+ |
ScopedTempDir::ScopedTempDir() { |
} |
@@ -23,7 +30,7 @@ bool ScopedTempDir::CreateUniqueTempDir() { |
// This "scoped_dir" prefix is only used on Windows and serves as a template |
// for the unique name. |
- if (!base::CreateNewTempDirectory(FILE_PATH_LITERAL("scoped_dir"), &path_)) |
+ if (!base::CreateNewTempDirectory(kScopedDirPrefix, &path_)) |
return false; |
return true; |
@@ -38,9 +45,7 @@ bool ScopedTempDir::CreateUniqueTempDirUnderPath(const FilePath& base_path) { |
return false; |
// Create a new, uniquely named directory under |base_path|. |
- if (!base::CreateTemporaryDirInDir(base_path, |
- FILE_PATH_LITERAL("scoped_dir_"), |
- &path_)) |
+ if (!base::CreateTemporaryDirInDir(base_path, kScopedDirPrefix, &path_)) |
return false; |
return true; |
@@ -85,4 +90,9 @@ bool ScopedTempDir::IsValid() const { |
return !path_.empty() && DirectoryExists(path_); |
} |
+// static |
+const FilePath::CharType* ScopedTempDir::GetTempDirPrefix() { |
+ return kScopedDirPrefix; |
+} |
+ |
} // namespace base |