| 362 | |
| 363 | |
| 364 | void Manager::loadAutosave() { |
| 365 | std::string patchPath = system::join(autosavePath, "patch.json"); |
| 366 | INFO("Loading autosave %s", patchPath.c_str()); |
| 367 | FILE* file = std::fopen(patchPath.c_str(), "r"); |
| 368 | if (!file) |
| 369 | throw Exception("Could not open autosave patch %s", patchPath.c_str()); |
| 370 | DEFER({std::fclose(file);}); |
| 371 | |
| 372 | json_error_t error; |
| 373 | json_t* rootJ = json_loadf(file, 0, &error); |
| 374 | if (!rootJ) |
| 375 | throw Exception("Failed to load patch. JSON parsing error at %s %d:%d %s", error.source, error.line, error.column, error.text); |
| 376 | DEFER({json_decref(rootJ);}); |
| 377 | |
| 378 | checkUnavailableModulesJson(rootJ); |
| 379 | |
| 380 | fromJson(rootJ); |
| 381 | } |
| 382 | |
| 383 | |
| 384 | void Manager::loadAction(std::string path) { |