From 8655b6d91597c3a62e9a0e0cae53c5ff7578b9f1 Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Thu, 12 May 2016 21:55:39 -0700 Subject: [PATCH] Adapt filesystem_error to new File error handling, expose on File. --- firmware/application/file.hpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/firmware/application/file.hpp b/firmware/application/file.hpp index 34466c4c0..d8c711f28 100644 --- a/firmware/application/file.hpp +++ b/firmware/application/file.hpp @@ -37,11 +37,7 @@ namespace std { namespace filesystem { struct filesystem_error { - const BYTE err; - - operator bool() const { - return err != FR_OK; - } + const uint32_t err; std::string what() const; }; @@ -129,6 +125,14 @@ public: return err == FR_OK; } + bool bad() const { + return err != FR_OK; + } + + std::filesystem::filesystem_error error() const { + return { err }; + } + bool read(void* const data, const size_t bytes_to_read); bool write(const void* const data, const size_t bytes_to_write);