MCPcopy Create free account
hub / github.com/GPUOpen-Tools/GPU-Reshape / ParseApplication

Method ParseApplication

Source/Test/Automation/Source/Parser.cpp:104–174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102}
103
104bool Parser::ParseApplication(const nlohmann::json &json, ComRef<ITestPass>& out) {
105 ApplicationInfo info;
106
107 // Parse attributes
108 info.enabled = json.value("Enabled", true);
109 info.requiresDiscovery = json.value("Discovery", false);
110 info.workingDirectory = ExpandPath(json.value("WorkingDirectory", "")).string();
111 info.connectionObjectThreshold = json.value("ConnectionObjectThreshold", 15u);
112
113 // Arguments may be strings or arrays of strings
114 if (auto it = json.find("Arguments"); it != json.end()) {
115 if (it->is_array()) {
116 for (auto&& argumentIt : *it) {
117 info.arguments.push_back(argumentIt.get<std::string>());
118 }
119 } else {
120 info.arguments.push_back(it->get<std::string>());
121 }
122 } else {
123 // Keep at least one invocation going
124 info.arguments.push_back("");
125 }
126
127 // Determine type
128 if (json.contains("Path")) {
129 std::filesystem::path path = ExpandPath(json["Path"].get<std::string>());
130
131 // Assume executable
132 info.type = ApplicationLaunchType::Executable;
133 info.identifier = path.string();
134 info.processName = path.filename().string();
135 } else if (json.contains("SteamID")) {
136 info.type = ApplicationLaunchType::Steam;
137 info.identifier = json["SteamID"].get<std::string>();
138 info.processName = json.value("Process", "NoName");
139 info.steam.path = json.value("SteamPath", "");
140 } else if (json.contains("PathFilter")) {
141 std::filesystem::path filter = ExpandPath(json["PathFilter"].get<std::string>());
142
143 // Assume executable
144 info.type = ApplicationLaunchType::ExecutableFilter;
145 info.identifier = filter.string();
146 info.processName = filter.filename().string();
147 } else {
148 Log(registry, "Unknown environment");
149 return false;
150 }
151
152 // All internal passes
153 std::vector<ComRef<ITestPass>> passes;
154
155 // Actual passes are optional
156 if (json.contains("Passes")) {
157 for (auto&& step : json["Passes"]) {
158 // Try to parse pass
159 ComRef<ITestPass> stepPass;
160 if (!ParsePass(step, stepPass)) {
161 return false;

Callers

nothing calls this directly

Calls 5

ExpandPathFunction · 0.85
findMethod · 0.80
LogFunction · 0.50
endMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected