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 #ifndef BIN_PLATFORM_H_ | 5 #ifndef BIN_PLATFORM_H_ |
6 #define BIN_PLATFORM_H_ | 6 #define BIN_PLATFORM_H_ |
7 | 7 |
8 #include "bin/builtin.h" | 8 #include "bin/builtin.h" |
9 #include "platform/globals.h" | 9 #include "platform/globals.h" |
10 | 10 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 // Stores the executable name. | 62 // Stores the executable name. |
63 static void SetExecutableName(const char* executable_name) { | 63 static void SetExecutableName(const char* executable_name) { |
64 executable_name_ = executable_name; | 64 executable_name_ = executable_name; |
65 } | 65 } |
66 static const char* GetExecutableName() { | 66 static const char* GetExecutableName() { |
67 return executable_name_; | 67 return executable_name_; |
68 } | 68 } |
69 static const char* GetResolvedExecutableName() { | 69 static const char* GetResolvedExecutableName() { |
70 if (resolved_executable_name_ == NULL) { | 70 if (resolved_executable_name_ == NULL) { |
71 // Try to resolve the executable path using platform specific APIs. | 71 // Try to resolve the executable path using platform specific APIs. |
72 resolved_executable_name_ = strdup(Platform::ResolveExecutablePath()); | 72 const char* resolved_name = Platform::ResolveExecutablePath(); |
| 73 if (resolved_name != NULL) { |
| 74 resolved_executable_name_ = strdup(resolved_name); |
| 75 } |
73 } | 76 } |
74 return resolved_executable_name_; | 77 return resolved_executable_name_; |
75 } | 78 } |
76 | 79 |
77 // Stores and gets the flags passed to the executable. | 80 // Stores and gets the flags passed to the executable. |
78 static void SetExecutableArguments(int script_index, char** argv) { | 81 static void SetExecutableArguments(int script_index, char** argv) { |
79 script_index_ = script_index; | 82 script_index_ = script_index; |
80 argv_ = argv; | 83 argv_ = argv; |
81 } | 84 } |
82 static int GetScriptIndex() { | 85 static int GetScriptIndex() { |
(...skipping 15 matching lines...) Expand all Loading... |
98 static char** argv_; // VM flags are argv_[1 ... script_index_ - 1] | 101 static char** argv_; // VM flags are argv_[1 ... script_index_ - 1] |
99 | 102 |
100 DISALLOW_ALLOCATION(); | 103 DISALLOW_ALLOCATION(); |
101 DISALLOW_IMPLICIT_CONSTRUCTORS(Platform); | 104 DISALLOW_IMPLICIT_CONSTRUCTORS(Platform); |
102 }; | 105 }; |
103 | 106 |
104 } // namespace bin | 107 } // namespace bin |
105 } // namespace dart | 108 } // namespace dart |
106 | 109 |
107 #endif // BIN_PLATFORM_H_ | 110 #endif // BIN_PLATFORM_H_ |
OLD | NEW |