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 <stdlib.h> | 5 #include <stdlib.h> |
6 #include <string.h> | 6 #include <string.h> |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 | 8 |
9 #include "include/dart_api.h" | 9 #include "include/dart_api.h" |
10 #include "include/dart_debugger_api.h" | 10 #include "include/dart_debugger_api.h" |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 } | 332 } |
333 const char* kVerboseDebug = "--verbose_debug"; | 333 const char* kVerboseDebug = "--verbose_debug"; |
334 if (strncmp(argv[i], kVerboseDebug, strlen(kVerboseDebug)) == 0) { | 334 if (strncmp(argv[i], kVerboseDebug, strlen(kVerboseDebug)) == 0) { |
335 *verbose_debug_seen = true; | 335 *verbose_debug_seen = true; |
336 } | 336 } |
337 vm_options->AddArgument(argv[i]); | 337 vm_options->AddArgument(argv[i]); |
338 i++; | 338 i++; |
339 } | 339 } |
340 } | 340 } |
341 | 341 |
| 342 // The arguments to the VM are at positions 1 through i-1 in argv. |
| 343 Platform::SetExecutableArguments(i, argv); |
342 | 344 |
343 // Get the script name. | 345 // Get the script name. |
344 if (i < argc) { | 346 if (i < argc) { |
345 *script_name = argv[i]; | 347 *script_name = argv[i]; |
346 i++; | 348 i++; |
347 } else { | 349 } else { |
348 return -1; | 350 return -1; |
349 } | 351 } |
350 | 352 |
351 // Parse out options to be passed to dart main. | 353 // Parse out options to be passed to dart main. |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 char errbuf[256]; | 456 char errbuf[256]; |
455 snprintf(errbuf, sizeof(errbuf), | 457 snprintf(errbuf, sizeof(errbuf), |
456 "Expected a library when loading script: %s", | 458 "Expected a library when loading script: %s", |
457 script_uri); | 459 script_uri); |
458 *error = strdup(errbuf); | 460 *error = strdup(errbuf); |
459 Dart_ExitScope(); | 461 Dart_ExitScope(); |
460 Dart_ShutdownIsolate(); | 462 Dart_ShutdownIsolate(); |
461 return NULL; | 463 return NULL; |
462 } | 464 } |
463 | 465 |
| 466 Platform::SetPackageRoot(package_root); |
464 Dart_Handle io_lib_url = DartUtils::NewString("dart:io"); | 467 Dart_Handle io_lib_url = DartUtils::NewString("dart:io"); |
465 CHECK_RESULT(io_lib_url); | 468 CHECK_RESULT(io_lib_url); |
466 Dart_Handle io_lib = Dart_LookupLibrary(io_lib_url); | 469 Dart_Handle io_lib = Dart_LookupLibrary(io_lib_url); |
467 CHECK_RESULT(io_lib); | 470 CHECK_RESULT(io_lib); |
468 Dart_Handle platform_class_name = DartUtils::NewString("Platform"); | 471 Dart_Handle platform_class_name = DartUtils::NewString("Platform"); |
469 CHECK_RESULT(platform_class_name); | 472 CHECK_RESULT(platform_class_name); |
470 Dart_Handle platform_type = | 473 Dart_Handle platform_type = |
471 Dart_GetType(io_lib, platform_class_name, 0, NULL); | 474 Dart_GetType(io_lib, platform_class_name, 0, NULL); |
472 CHECK_RESULT(platform_type); | 475 CHECK_RESULT(platform_type); |
473 Dart_Handle script_name_name = DartUtils::NewString("_nativeScript"); | 476 Dart_Handle script_name_name = DartUtils::NewString("_nativeScript"); |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
866 | 869 |
867 return Process::GlobalExitCode(); | 870 return Process::GlobalExitCode(); |
868 } | 871 } |
869 | 872 |
870 } // namespace bin | 873 } // namespace bin |
871 } // namespace dart | 874 } // namespace dart |
872 | 875 |
873 int main(int argc, char** argv) { | 876 int main(int argc, char** argv) { |
874 return dart::bin::main(argc, argv); | 877 return dart::bin::main(argc, argv); |
875 } | 878 } |
OLD | NEW |