| OLD | NEW |
| 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/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/thread.h" | 9 #include "bin/thread.h" |
| 10 #include "bin/utils.h" | 10 #include "bin/utils.h" |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 | 404 |
| 405 | 405 |
| 406 void FUNCTION_NAME(File_Directory)(Dart_NativeArguments args) { | 406 void FUNCTION_NAME(File_Directory)(Dart_NativeArguments args) { |
| 407 Dart_EnterScope(); | 407 Dart_EnterScope(); |
| 408 const char* str = | 408 const char* str = |
| 409 DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0)); | 409 DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0)); |
| 410 char* str_copy = strdup(str); | 410 char* str_copy = strdup(str); |
| 411 char* path = File::GetContainingDirectory(str_copy); | 411 char* path = File::GetContainingDirectory(str_copy); |
| 412 free(str_copy); | 412 free(str_copy); |
| 413 if (path != NULL) { | 413 if (path != NULL) { |
| 414 Dart_SetReturnValue(args, Dart_NewString(path)); | 414 Dart_SetReturnValue(args, DartUtils::NewString(path)); |
| 415 free(path); | 415 free(path); |
| 416 } else { | 416 } else { |
| 417 Dart_Handle err = DartUtils::NewDartOSError(); | 417 Dart_Handle err = DartUtils::NewDartOSError(); |
| 418 if (Dart_IsError(err)) Dart_PropagateError(err); | 418 if (Dart_IsError(err)) Dart_PropagateError(err); |
| 419 Dart_SetReturnValue(args, err); | 419 Dart_SetReturnValue(args, err); |
| 420 } | 420 } |
| 421 Dart_ExitScope(); | 421 Dart_ExitScope(); |
| 422 } | 422 } |
| 423 | 423 |
| 424 | 424 |
| 425 void FUNCTION_NAME(File_FullPath)(Dart_NativeArguments args) { | 425 void FUNCTION_NAME(File_FullPath)(Dart_NativeArguments args) { |
| 426 Dart_EnterScope(); | 426 Dart_EnterScope(); |
| 427 const char* str = | 427 const char* str = |
| 428 DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0)); | 428 DartUtils::GetStringValue(Dart_GetNativeArgument(args, 0)); |
| 429 char* path = File::GetCanonicalPath(str); | 429 char* path = File::GetCanonicalPath(str); |
| 430 if (path != NULL) { | 430 if (path != NULL) { |
| 431 Dart_SetReturnValue(args, Dart_NewString(path)); | 431 Dart_SetReturnValue(args, DartUtils::NewString(path)); |
| 432 free(path); | 432 free(path); |
| 433 } else { | 433 } else { |
| 434 Dart_Handle err = DartUtils::NewDartOSError(); | 434 Dart_Handle err = DartUtils::NewDartOSError(); |
| 435 if (Dart_IsError(err)) Dart_PropagateError(err); | 435 if (Dart_IsError(err)) Dart_PropagateError(err); |
| 436 Dart_SetReturnValue(args, err); | 436 Dart_SetReturnValue(args, err); |
| 437 } | 437 } |
| 438 Dart_ExitScope(); | 438 Dart_ExitScope(); |
| 439 } | 439 } |
| 440 | 440 |
| 441 | 441 |
| (...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 942 Dart_EnterScope(); | 942 Dart_EnterScope(); |
| 943 Dart_SetReturnValue(args, Dart_Null()); | 943 Dart_SetReturnValue(args, Dart_Null()); |
| 944 Dart_Port service_port = File::GetServicePort(); | 944 Dart_Port service_port = File::GetServicePort(); |
| 945 if (service_port != ILLEGAL_PORT) { | 945 if (service_port != ILLEGAL_PORT) { |
| 946 // Return a send port for the service port. | 946 // Return a send port for the service port. |
| 947 Dart_Handle send_port = Dart_NewSendPort(service_port); | 947 Dart_Handle send_port = Dart_NewSendPort(service_port); |
| 948 Dart_SetReturnValue(args, send_port); | 948 Dart_SetReturnValue(args, send_port); |
| 949 } | 949 } |
| 950 Dart_ExitScope(); | 950 Dart_ExitScope(); |
| 951 } | 951 } |
| OLD | NEW |