Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 481 Dart_SetReturnValue(args, Dart_NewBoolean(result)); | 481 Dart_SetReturnValue(args, Dart_NewBoolean(result)); |
| 482 } else { | 482 } else { |
| 483 Dart_Handle err = DartUtils::NewDartOSError(); | 483 Dart_Handle err = DartUtils::NewDartOSError(); |
| 484 if (Dart_IsError(err)) Dart_PropagateError(err); | 484 if (Dart_IsError(err)) Dart_PropagateError(err); |
| 485 Dart_SetReturnValue(args, err); | 485 Dart_SetReturnValue(args, err); |
| 486 } | 486 } |
| 487 Dart_ExitScope(); | 487 Dart_ExitScope(); |
| 488 } | 488 } |
| 489 | 489 |
| 490 | 490 |
| 491 void FUNCTION_NAME(File_DeleteLink)(Dart_NativeArguments args) { | |
| 492 Dart_EnterScope(); | |
| 493 const char* str = | |
| 494 DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0)); | |
| 495 bool result = File::DeleteLink(str); | |
| 496 if (result) { | |
| 497 Dart_SetReturnValue(args, Dart_NewBoolean(result)); | |
| 498 } else { | |
| 499 Dart_Handle err = DartUtils::NewDartOSError( | |
| 500 new OSError(-1, "Not a link", OSError::kSystem)); | |
|
Søren Gjesse
2013/04/05 12:52:50
Is this only failing when this is not a link? Coul
Anders Johnsen
2013/04/08 06:50:49
You are right. Do you know how we can set this fro
| |
| 501 if (Dart_IsError(err)) Dart_PropagateError(err); | |
| 502 Dart_SetReturnValue(args, err); | |
| 503 } | |
| 504 Dart_ExitScope(); | |
| 505 } | |
| 506 | |
| 507 | |
| 491 void FUNCTION_NAME(File_Directory)(Dart_NativeArguments args) { | 508 void FUNCTION_NAME(File_Directory)(Dart_NativeArguments args) { |
| 492 Dart_EnterScope(); | 509 Dart_EnterScope(); |
| 493 const char* str = | 510 const char* str = |
| 494 DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0)); | 511 DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0)); |
| 495 char* str_copy = strdup(str); | 512 char* str_copy = strdup(str); |
| 496 char* path = File::GetContainingDirectory(str_copy); | 513 char* path = File::GetContainingDirectory(str_copy); |
| 497 free(str_copy); | 514 free(str_copy); |
| 498 if (path != NULL) { | 515 if (path != NULL) { |
| 499 Dart_SetReturnValue(args, DartUtils::NewString(path)); | 516 Dart_SetReturnValue(args, DartUtils::NewString(path)); |
| 500 free(path); | 517 free(path); |
| (...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1082 Dart_EnterScope(); | 1099 Dart_EnterScope(); |
| 1083 Dart_SetReturnValue(args, Dart_Null()); | 1100 Dart_SetReturnValue(args, Dart_Null()); |
| 1084 Dart_Port service_port = File::GetServicePort(); | 1101 Dart_Port service_port = File::GetServicePort(); |
| 1085 if (service_port != ILLEGAL_PORT) { | 1102 if (service_port != ILLEGAL_PORT) { |
| 1086 // Return a send port for the service port. | 1103 // Return a send port for the service port. |
| 1087 Dart_Handle send_port = Dart_NewSendPort(service_port); | 1104 Dart_Handle send_port = Dart_NewSendPort(service_port); |
| 1088 Dart_SetReturnValue(args, send_port); | 1105 Dart_SetReturnValue(args, send_port); |
| 1089 } | 1106 } |
| 1090 Dart_ExitScope(); | 1107 Dart_ExitScope(); |
| 1091 } | 1108 } |
| OLD | NEW |