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

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

Issue 8598011: Implement delete on File objects. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 years, 1 month 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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/file.h" 5 #include "bin/file.h"
6 6
7 #include "bin/builtin.h" 7 #include "bin/builtin.h"
8 #include "bin/dartutils.h" 8 #include "bin/dartutils.h"
9 9
10 #include "include/dart_api.h" 10 #include "include/dart_api.h"
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 void FUNCTION_NAME(File_Create)(Dart_NativeArguments args) { 264 void FUNCTION_NAME(File_Create)(Dart_NativeArguments args) {
265 Dart_EnterScope(); 265 Dart_EnterScope();
266 const char* str = 266 const char* str =
267 DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0)); 267 DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0));
268 bool result = File::Create(str); 268 bool result = File::Create(str);
269 Dart_SetReturnValue(args, Dart_NewBoolean(result)); 269 Dart_SetReturnValue(args, Dart_NewBoolean(result));
270 Dart_ExitScope(); 270 Dart_ExitScope();
271 } 271 }
272 272
273 273
274 void FUNCTION_NAME(File_Delete)(Dart_NativeArguments args) {
275 Dart_EnterScope();
276 const char* str =
277 DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0));
278 bool result = File::Delete(str);
279 Dart_SetReturnValue(args, Dart_NewBoolean(result));
280 Dart_ExitScope();
281 }
282
283
274 void FUNCTION_NAME(File_FullPath)(Dart_NativeArguments args) { 284 void FUNCTION_NAME(File_FullPath)(Dart_NativeArguments args) {
275 Dart_EnterScope(); 285 Dart_EnterScope();
276 const char* str = 286 const char* str =
277 DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0)); 287 DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0));
278 char* path = File::GetCanonicalPath(str); 288 char* path = File::GetCanonicalPath(str);
279 if (path != NULL) { 289 if (path != NULL) {
280 Dart_SetReturnValue(args, Dart_NewString(path)); 290 Dart_SetReturnValue(args, Dart_NewString(path));
281 free(path); 291 free(path);
282 } 292 }
283 Dart_ExitScope(); 293 Dart_ExitScope();
284 } 294 }
OLDNEW
« no previous file with comments | « runtime/bin/file.h ('k') | runtime/bin/file.dart » ('j') | tests/standalone/src/FileTest.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698