| 689 | } |
| 690 | |
| 691 | void Gui::PreferencePackManager::BackupCurrentConfig() const |
| 692 | { |
| 693 | auto backupDirectory = getSavedPreferencePacksPath() / "Backups"; |
| 694 | fs::create_directories(backupDirectory); |
| 695 | |
| 696 | // Create a timestamped filename: |
| 697 | auto time = std::time(nullptr); |
| 698 | std::ostringstream timestampStream; |
| 699 | timestampStream << "user." << time << ".cfg"; |
| 700 | auto filename = backupDirectory / timestampStream.str(); |
| 701 | |
| 702 | // Save the current config: |
| 703 | App::GetApplication().GetUserParameter().SaveDocument( |
| 704 | Base::FileInfo::pathToString(filename).c_str() |
| 705 | ); |
| 706 | } |
| 707 | |
| 708 | // FIXME: Replace with more accurate C++20 solution once its usable: https://stackoverflow.com/a/68593141 |
| 709 | template<typename TP> |
nothing calls this directly
no test coverage detected