Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1106)

Unified Diff: runtime/bin/directory_win.cc

Issue 25720002: Add Directory.systemTemp getter to replace createSystemTemp(). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add dart2js patch files. Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: runtime/bin/directory_win.cc
diff --git a/runtime/bin/directory_win.cc b/runtime/bin/directory_win.cc
index c72f4ef8f0cd0c9a1092f9577464adc3945969ca..18345adaf61f8e88b7a3db451696a61148c3a98a 100644
--- a/runtime/bin/directory_win.cc
+++ b/runtime/bin/directory_win.cc
@@ -383,21 +383,22 @@ 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) {

Powered by Google App Engine
This is Rietveld 408576698