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 | 9 |
10 | 10 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 return executable_name_; | 49 return executable_name_; |
50 } | 50 } |
51 static const char* GetResolvedExecutableName() { | 51 static const char* GetResolvedExecutableName() { |
52 if (resolved_executable_name_ == NULL) { | 52 if (resolved_executable_name_ == NULL) { |
53 // Try to resolve the executable path using platform specific APIs. | 53 // Try to resolve the executable path using platform specific APIs. |
54 resolved_executable_name_ = Platform::ResolveExecutablePath(); | 54 resolved_executable_name_ = Platform::ResolveExecutablePath(); |
55 } | 55 } |
56 return resolved_executable_name_; | 56 return resolved_executable_name_; |
57 } | 57 } |
58 | 58 |
59 // Stores and gets the package root. | |
60 static void SetPackageRoot(const char* package_root) { | |
61 package_root_ = package_root; | |
62 } | |
63 static const char* GetPackageRoot() { | |
64 return package_root_; | |
65 } | |
66 | |
67 // Stores and gets the flags passed to the executable. | 59 // Stores and gets the flags passed to the executable. |
68 static void SetExecutableArguments(int script_index, char** argv) { | 60 static void SetExecutableArguments(int script_index, char** argv) { |
69 script_index_ = script_index; | 61 script_index_ = script_index; |
70 argv_ = argv; | 62 argv_ = argv; |
71 } | 63 } |
72 static int GetScriptIndex() { | 64 static int GetScriptIndex() { |
73 return script_index_; | 65 return script_index_; |
74 } | 66 } |
75 static char** GetArgv() { | 67 static char** GetArgv() { |
76 return argv_; | 68 return argv_; |
77 } | 69 } |
78 | 70 |
79 static DART_NORETURN void Exit(int exit_code); | 71 static DART_NORETURN void Exit(int exit_code); |
80 | 72 |
81 private: | 73 private: |
82 // The path to the executable. | 74 // The path to the executable. |
83 static const char* executable_name_; | 75 static const char* executable_name_; |
84 // The path to the resolved executable. | 76 // The path to the resolved executable. |
85 static const char* resolved_executable_name_; | 77 static const char* resolved_executable_name_; |
86 | 78 |
87 static const char* package_root_; | |
88 static int script_index_; | 79 static int script_index_; |
89 static char** argv_; // VM flags are argv_[1 ... script_index_ - 1] | 80 static char** argv_; // VM flags are argv_[1 ... script_index_ - 1] |
90 | 81 |
91 DISALLOW_ALLOCATION(); | 82 DISALLOW_ALLOCATION(); |
92 DISALLOW_IMPLICIT_CONSTRUCTORS(Platform); | 83 DISALLOW_IMPLICIT_CONSTRUCTORS(Platform); |
93 }; | 84 }; |
94 | 85 |
95 } // namespace bin | 86 } // namespace bin |
96 } // namespace dart | 87 } // namespace dart |
97 | 88 |
98 #endif // BIN_PLATFORM_H_ | 89 #endif // BIN_PLATFORM_H_ |
OLD | NEW |