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

Side by Side Diff: runtime/bin/directory.cc

Issue 9316066: Implement recursive directory deletion. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 8 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "bin/directory.h" 5 #include "bin/directory.h"
6 6
7 #include "bin/dartutils.h" 7 #include "bin/dartutils.h"
8 #include "include/dart_api.h" 8 #include "include/dart_api.h"
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 10
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 } 114 }
115 Dart_SetReturnValue(args, Dart_Null()); 115 Dart_SetReturnValue(args, Dart_Null());
116 } 116 }
117 Dart_ExitScope(); 117 Dart_ExitScope();
118 } 118 }
119 119
120 120
121 void FUNCTION_NAME(Directory_Delete)(Dart_NativeArguments args) { 121 void FUNCTION_NAME(Directory_Delete)(Dart_NativeArguments args) {
122 Dart_EnterScope(); 122 Dart_EnterScope();
123 Dart_Handle path = Dart_GetNativeArgument(args, 0); 123 Dart_Handle path = Dart_GetNativeArgument(args, 0);
124 if (Dart_IsString(path)) { 124 Dart_Handle recursive = Dart_GetNativeArgument(args, 1);
125 bool deleted = Directory::Delete(DartUtils::GetStringValue(path)); 125 if (Dart_IsString(path) && Dart_IsBoolean(recursive)) {
126 bool deleted = Directory::Delete(DartUtils::GetStringValue(path),
127 DartUtils::GetBooleanValue(recursive));
126 Dart_SetReturnValue(args, Dart_NewBoolean(deleted)); 128 Dart_SetReturnValue(args, Dart_NewBoolean(deleted));
127 } else { 129 } else {
128 Dart_SetReturnValue(args, Dart_NewBoolean(false)); 130 Dart_SetReturnValue(args, Dart_NewBoolean(false));
129 } 131 }
130 Dart_ExitScope(); 132 Dart_ExitScope();
131 } 133 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698