mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-27 02:01:42 +00:00
Merge branch 'main' into 2027
This commit is contained in:
@@ -330,8 +330,8 @@ public class Topic {
|
||||
}
|
||||
|
||||
/** NetworkTables instance. */
|
||||
protected NetworkTableInstance m_inst;
|
||||
protected final NetworkTableInstance m_inst;
|
||||
|
||||
/** NetworkTables handle. */
|
||||
protected int m_handle;
|
||||
protected final int m_handle;
|
||||
}
|
||||
|
||||
@@ -302,6 +302,21 @@ void NetworkServer::ProcessAllLocal() {
|
||||
}
|
||||
|
||||
void NetworkServer::LoadPersistent() {
|
||||
// check if SavePersistent was interrupted and left a backup file;
|
||||
// if so, try to restore it
|
||||
auto bak = fmt::format("{}.bck", m_persistentFilename);
|
||||
if (!fs::exists(m_persistentFilename) && fs::exists(bak)) {
|
||||
INFO(
|
||||
"restoring persistent file from backup '{}', since original '{}' is "
|
||||
"missing",
|
||||
bak, m_persistentFilename);
|
||||
std::error_code ec;
|
||||
fs::rename(bak, m_persistentFilename, ec);
|
||||
if (ec.value() != 0) {
|
||||
INFO("failed to restore backup: {}", ec.message());
|
||||
}
|
||||
}
|
||||
|
||||
auto fileBuffer = wpi::util::MemoryBuffer::GetFile(m_persistentFilename);
|
||||
if (!fileBuffer) {
|
||||
INFO(
|
||||
|
||||
Reference in New Issue
Block a user