MCPcopy Create free account
hub / github.com/acidicoala/SmokeAPI / parse_sdk

Function parse_sdk

tools/src/steamworks_parser.cpp:145–174  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

143 }
144
145 void parse_sdk(const fs::path& sdk_path, nlohmann::ordered_json& lookup, BS::thread_pool<>& pool) {
146 const auto headers_dir = sdk_path / "headers" / "steam";
147 const auto headers_dir_str = kb::path::to_str(headers_dir);
148
149 if(not fs::exists(headers_dir)) {
150 LOG_WARN("Warning: SDK missing 'headers/steam' directory: {}", headers_dir_str);
151 return;
152 }
153
154 LOG_INFO("Parsing SDK: {}", headers_dir_str);
155
156 // Go over each file in headers directory
157 for(const auto& entry : fs::directory_iterator(headers_dir)) {
158 if(const auto& header_path = entry.path(); header_path.extension() == ".h") {
159 const auto task = pool.submit_task(
160 [&, header_path] {
161 try {
162 LOG_DEBUG("Parsing header: {}", kb::path::to_str(header_path));
163
164 const auto processed_header = manually_preprocess_header(header_path);
165 parse_header(processed_header, lookup);
166 } catch(std::exception& e) {
167 LOG_CRITICAL(e.what());
168 exit(EXIT_FAILURE);
169 }
170 }
171 );
172 }
173 }
174 }
175
176 void generate_lookup_json(const fs::path& steamworks_dir, const std::set<std::string>& sdk_filter) {
177 // Ideally the top level lookup should be unordered json (i.e. keys sorted alphabetically).

Callers 1

generate_lookup_jsonFunction · 0.85

Calls 2

parse_headerFunction · 0.85

Tested by

no test coverage detected