| Index: runtime/bin/platform_macos.cc
|
| diff --git a/runtime/bin/platform_macos.cc b/runtime/bin/platform_macos.cc
|
| index 84cce9293ea7a5951b3d8f83bd54f40409721a9e..81455ba3d3988ae7348433d517836d4b83fb96ed 100644
|
| --- a/runtime/bin/platform_macos.cc
|
| +++ b/runtime/bin/platform_macos.cc
|
| @@ -1,9 +1,10 @@
|
| -// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
|
| +// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
|
| // for details. All rights reserved. Use of this source code is governed by a
|
| // BSD-style license that can be found in the LICENSE file.
|
|
|
| #include "bin/platform.h"
|
|
|
| +#include <crt_externs.h>
|
| #include <signal.h>
|
| #include <string.h>
|
| #include <unistd.h>
|
| @@ -39,6 +40,24 @@ bool Platform::LocalHostname(char *buffer, intptr_t buffer_length) {
|
| }
|
|
|
|
|
| +char** Platform::Environment(intptr_t* count) {
|
| + // Using environ directly is only safe as long as we do not
|
| + // provide access to modifying environment variables.
|
| + // On MacOS you have to do a bit of magic to get to the
|
| + // environment strings.
|
| + char** environ = *(_NSGetEnviron());
|
| + intptr_t i = 0;
|
| + char** tmp = environ;
|
| + while (*(tmp++) != NULL) i++;
|
| + *count = i;
|
| + char** result = new char*[i];
|
| + for (intptr_t current = 0; current < i; current++) {
|
| + result[current] = environ[current];
|
| + }
|
| + return result;
|
| +}
|
| +
|
| +
|
| char* Platform::StrError(int error_code) {
|
| static const int kBufferSize = 1024;
|
| char* error = static_cast<char*>(malloc(kBufferSize));
|
|
|