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

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

Issue 12691002: dart:io | Add Link class, as sibling to File and Directory. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Reverted patch, including fixes 19774 and 19775. Created 7 years, 9 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 #include "bin/io_buffer.h" 9 #include "bin/io_buffer.h"
10 #include "bin/thread.h" 10 #include "bin/thread.h"
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 Dart_SetReturnValue(args, Dart_NewBoolean(result)); 418 Dart_SetReturnValue(args, Dart_NewBoolean(result));
419 } else { 419 } else {
420 Dart_Handle err = DartUtils::NewDartOSError(); 420 Dart_Handle err = DartUtils::NewDartOSError();
421 if (Dart_IsError(err)) Dart_PropagateError(err); 421 if (Dart_IsError(err)) Dart_PropagateError(err);
422 Dart_SetReturnValue(args, err); 422 Dart_SetReturnValue(args, err);
423 } 423 }
424 Dart_ExitScope(); 424 Dart_ExitScope();
425 } 425 }
426 426
427 427
428 void FUNCTION_NAME(File_CreateLink)(Dart_NativeArguments args) {
429 Dart_EnterScope();
430 if (Dart_IsString(Dart_GetNativeArgument(args, 0)) &&
431 Dart_IsString(Dart_GetNativeArgument(args, 1))) {
432 const char* name =
433 DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0));
434 const char* target =
435 DartUtils::GetStringValue(Dart_GetNativeArgument(args, 1));
436 if (!File::CreateLink(name, target)) {
437 Dart_Handle err = DartUtils::NewDartOSError();
438 if (Dart_IsError(err)) Dart_PropagateError(err);
439 Dart_SetReturnValue(args, err);
440 }
441 } else {
442 OSError os_error(-1, "Invalid argument", OSError::kUnknown);
443 Dart_Handle err = DartUtils::NewDartOSError(&os_error);
Søren Gjesse 2013/03/12 08:41:49 I think we should use DartUtils::ArgumentError her
Bill Hesse 2013/03/13 16:17:38 Done.
444 if (Dart_IsError(err)) Dart_PropagateError(err);
445 Dart_SetReturnValue(args, err);
446 }
447 Dart_ExitScope();
448 }
449
450
428 void FUNCTION_NAME(File_Delete)(Dart_NativeArguments args) { 451 void FUNCTION_NAME(File_Delete)(Dart_NativeArguments args) {
429 Dart_EnterScope(); 452 Dart_EnterScope();
430 const char* str = 453 const char* str =
431 DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0)); 454 DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0));
432 bool result = File::Delete(str); 455 bool result = File::Delete(str);
433 if (result) { 456 if (result) {
434 Dart_SetReturnValue(args, Dart_NewBoolean(result)); 457 Dart_SetReturnValue(args, Dart_NewBoolean(result));
435 } else { 458 } else {
436 Dart_Handle err = DartUtils::NewDartOSError(); 459 Dart_Handle err = DartUtils::NewDartOSError();
437 if (Dart_IsError(err)) Dart_PropagateError(err); 460 if (Dart_IsError(err)) Dart_PropagateError(err);
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
1009 Dart_EnterScope(); 1032 Dart_EnterScope();
1010 Dart_SetReturnValue(args, Dart_Null()); 1033 Dart_SetReturnValue(args, Dart_Null());
1011 Dart_Port service_port = File::GetServicePort(); 1034 Dart_Port service_port = File::GetServicePort();
1012 if (service_port != ILLEGAL_PORT) { 1035 if (service_port != ILLEGAL_PORT) {
1013 // Return a send port for the service port. 1036 // Return a send port for the service port.
1014 Dart_Handle send_port = Dart_NewSendPort(service_port); 1037 Dart_Handle send_port = Dart_NewSendPort(service_port);
1015 Dart_SetReturnValue(args, send_port); 1038 Dart_SetReturnValue(args, send_port);
1016 } 1039 }
1017 Dart_ExitScope(); 1040 Dart_ExitScope();
1018 } 1041 }
OLDNEW
« no previous file with comments | « runtime/bin/file.h ('k') | runtime/bin/file_android.cc » ('j') | sdk/lib/io/link.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698