mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[wpiutil] Return wpi::expected from MemoryBuffer::GetFile (#7069)
This commit is contained in:
@@ -10,7 +10,6 @@
|
||||
#include <fmt/format.h>
|
||||
#include <units/angle.h>
|
||||
#include <wpi/MathExtras.h>
|
||||
#include <wpi/MemoryBuffer.h>
|
||||
#include <wpi/StringExtras.h>
|
||||
#include <wpi/StringMap.h>
|
||||
|
||||
|
||||
@@ -35,15 +35,15 @@ void LogLoader::Display() {
|
||||
if (!m_opener->result().empty()) {
|
||||
m_filename = m_opener->result()[0];
|
||||
|
||||
std::error_code ec;
|
||||
auto buf = wpi::MemoryBuffer::GetFile(m_filename, ec);
|
||||
if (ec) {
|
||||
auto fileBuffer = wpi::MemoryBuffer::GetFile(m_filename);
|
||||
if (!fileBuffer) {
|
||||
ImGui::OpenPopup("Error");
|
||||
m_error = fmt::format("Could not open file: {}", ec.message());
|
||||
m_error = fmt::format("Could not open file: {}",
|
||||
fileBuffer.error().message());
|
||||
return;
|
||||
}
|
||||
|
||||
wpi::log::DataLogReader reader{std::move(buf)};
|
||||
wpi::log::DataLogReader reader{std::move(*fileBuffer)};
|
||||
if (!reader.IsValid()) {
|
||||
ImGui::OpenPopup("Error");
|
||||
m_error = "Not a valid datalog file";
|
||||
|
||||
Reference in New Issue
Block a user