MCPcopy Create free account
hub / github.com/FreeCAD/FreeCAD / BackupCurrentConfig

Method BackupCurrentConfig

src/Gui/PreferencePackManager.cpp:691–706  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

689}
690
691void 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
709template<typename TP>

Callers

nothing calls this directly

Calls 3

SaveDocumentMethod · 0.80
strMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected