Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(976)

Side by Side Diff: runtime/bin/platform.h

Issue 1334353002: - Add getters for the current packageRoot or packageMap. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 private: 71 private:
80 // The path to the executable. 72 // The path to the executable.
81 static const char* executable_name_; 73 static const char* executable_name_;
82 // The path to the resolved executable. 74 // The path to the resolved executable.
83 static const char* resolved_executable_name_; 75 static const char* resolved_executable_name_;
84 76
85 static const char* package_root_;
86 static int script_index_; 77 static int script_index_;
87 static char** argv_; // VM flags are argv_[1 ... script_index_ - 1] 78 static char** argv_; // VM flags are argv_[1 ... script_index_ - 1]
88 79
89 DISALLOW_ALLOCATION(); 80 DISALLOW_ALLOCATION();
90 DISALLOW_IMPLICIT_CONSTRUCTORS(Platform); 81 DISALLOW_IMPLICIT_CONSTRUCTORS(Platform);
91 }; 82 };
92 83
93 } // namespace bin 84 } // namespace bin
94 } // namespace dart 85 } // namespace dart
95 86
96 #endif // BIN_PLATFORM_H_ 87 #endif // BIN_PLATFORM_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698