| 604 | } |
| 605 | |
| 606 | static int compare(const CommandLineOptions& options) |
| 607 | { |
| 608 | auto file1 = fs::u8path(options.path); |
| 609 | auto file2 = fs::u8path(options.path2); |
| 610 | auto displayAllDivergences = options.all.empty() == false; |
| 611 | |
| 612 | if (file1.empty() || file2.empty()) |
| 613 | { |
| 614 | Logging::error("Unable to compare gamestates..."); |
| 615 | Logging::error(" The required compare file paths have not been specified."); |
| 616 | Logging::error(" compare [options] <path1> <path2>"); |
| 617 | return EXIT_FAILURE; |
| 618 | } |
| 619 | |
| 620 | auto result = EXIT_SUCCESS; |
| 621 | try |
| 622 | { |
| 623 | if (OpenLoco::GameSaveCompare::compareGameStates(file1, file2, displayAllDivergences)) |
| 624 | { |
| 625 | Logging::info("MATCHES", file1, file2); |
| 626 | } |
| 627 | else |
| 628 | { |
| 629 | Logging::error("DOES NOT MATCH", file1, file2); |
| 630 | result = EXIT_FAILURE; |
| 631 | } |
| 632 | } |
| 633 | catch (std::exception& e) |
| 634 | { |
| 635 | Logging::error("Unable to compare gamestates: {} to {}", file1, file2); |
| 636 | Logging::error("Exception reason {}", e.what()); |
| 637 | result = EXIT_FAILURE; |
| 638 | } |
| 639 | |
| 640 | return result; |
| 641 | } |
| 642 | } |
no test coverage detected