Index: runtime/bin/directory_win.cc |
diff --git a/runtime/bin/directory_win.cc b/runtime/bin/directory_win.cc |
index c72f4ef8f0cd0c9a1092f9577464adc3945969ca..e3e390f4292ac0bd7328ced0f9a65869afe5a457 100644 |
--- a/runtime/bin/directory_win.cc |
+++ b/runtime/bin/directory_win.cc |
@@ -383,21 +383,23 @@ bool Directory::Create(const char* dir_name) { |
} |
-char* Directory::CreateTemp(const char* const_template, bool system) { |
- // Returns a new, unused directory name, modifying the contents of |
- // dir_template. Creates this directory, with a default security |
+char* Directory::SystemTemp() { |
+ PathBuffer path; |
+ path.Reset(GetTempPathW(MAX_PATH, path.AsStringW()) - 1); // Remove \ at end. |
+ return path.AsString(); |
+} |
+ |
+ |
+char* Directory::CreateTemp(const char* prefix) { |
+ // Returns a new, unused directory name, adding characters to the |
+ // end of prefix. |
+ // Creates this directory, with a default security |
// descriptor inherited from its parent directory. |
// The return value must be freed by the caller. |
PathBuffer path; |
- if (system) { |
- path.Reset(GetTempPathW(MAX_PATH, path.AsStringW())); |
- if (path.length() == 0) { |
- return NULL; |
- } |
- } |
- const wchar_t* system_template = StringUtils::Utf8ToWide(const_template); |
- path.AddW(system_template); |
- free(const_cast<wchar_t*>(system_template)); |
+ const wchar_t* system_prefix = StringUtils::Utf8ToWide(prefix); |
+ path.AddW(system_prefix); |
+ free(const_cast<wchar_t*>(system_prefix)); |
// Length of xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx is 36. |
if (path.length() > MAX_PATH - 36) { |