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

Unified Diff: runtime/bin/directory.cc

Issue 25720002: Add Directory.systemTemp getter to replace createSystemTemp(). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Don't add an extra / to a directory ending in // 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
« no previous file with comments | « runtime/bin/directory.h ('k') | runtime/bin/directory_android.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/directory.cc
diff --git a/runtime/bin/directory.cc b/runtime/bin/directory.cc
index 6aa4d09e1190296b68281b11bbeeff6b354fb4e3..10c53b9ff8b3774dae56dea025e5653493b77585 100644
--- a/runtime/bin/directory.cc
+++ b/runtime/bin/directory.cc
@@ -76,16 +76,22 @@ void FUNCTION_NAME(Directory_Create)(Dart_NativeArguments args) {
}
+void FUNCTION_NAME(Directory_SystemTemp)(
+ Dart_NativeArguments args) {
+ char* result = Directory::SystemTemp();
+ Dart_SetReturnValue(args, DartUtils::NewString(result));
+ free(result);
+}
+
+
void FUNCTION_NAME(Directory_CreateTemp)(Dart_NativeArguments args) {
Dart_Handle path = Dart_GetNativeArgument(args, 0);
- Dart_Handle system = Dart_GetNativeArgument(args, 1);
if (!Dart_IsString(path)) {
Dart_SetReturnValue(args, DartUtils::NewDartArgumentError(
- "Template argument of CreateSystemTempSync is not a String"));
+ "Prefix argument of CreateSystemTempSync is not a String"));
return;
}
- char* result = Directory::CreateTemp(DartUtils::GetStringValue(path),
- DartUtils::GetBooleanValue(system));
+ char* result = Directory::CreateTemp(DartUtils::GetStringValue(path));
if (result != NULL) {
Dart_SetReturnValue(args, DartUtils::NewString(result));
free(result);
@@ -195,23 +201,7 @@ CObject* Directory::ExistsRequest(const CObjectArray& request) {
CObject* Directory::CreateTempRequest(const CObjectArray& request) {
if (request.Length() == 1 && request[0]->IsString()) {
CObjectString path(request[0]);
- char* result = Directory::CreateTemp(path.CString(), false);
- if (result != NULL) {
- CObject* temp_dir = new CObjectString(CObject::NewString(result));
- free(result);
- return temp_dir;
- } else {
- return CObject::NewOSError();
- }
- }
- return CObject::IllegalArgumentError();
-}
-
-
-CObject* Directory::CreateSystemTempRequest(const CObjectArray& request) {
- if (request.Length() == 1 && request[0]->IsString()) {
- CObjectString path(request[0]);
- char* result = Directory::CreateTemp(path.CString(), true);
+ char* result = Directory::CreateTemp(path.CString());
if (result != NULL) {
CObject* temp_dir = new CObjectString(CObject::NewString(result));
free(result);
« no previous file with comments | « runtime/bin/directory.h ('k') | runtime/bin/directory_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698