Move additional FR_* error values to file.hpp for public use.

This commit is contained in:
Jared Boone 2016-12-06 09:34:45 -08:00
parent f2dd6827ea
commit 431aae333a
2 changed files with 10 additions and 7 deletions

View File

@ -25,13 +25,6 @@
#include <locale> #include <locale>
#include <codecvt> #include <codecvt>
/* Values added to FatFs FRESULT enum, values outside the FRESULT data type */
static_assert(sizeof(FIL::err) == 1, "FatFs FIL::err size not expected.");
#define FR_DISK_FULL (0x100)
#define FR_EOF (0x101)
#define FR_BAD_SEEK (0x102)
#define FR_UNEXPECTED (0x103)
Optional<File::Error> File::open_fatfs(const std::filesystem::path& filename, BYTE mode) { Optional<File::Error> File::open_fatfs(const std::filesystem::path& filename, BYTE mode) {
auto result = f_open(&f, reinterpret_cast<const TCHAR*>(filename.c_str()), mode); auto result = f_open(&f, reinterpret_cast<const TCHAR*>(filename.c_str()), mode);
if( result == FR_OK ) { if( result == FR_OK ) {

View File

@ -233,6 +233,16 @@ space_info space(const path& p);
std::filesystem::path next_filename_stem_matching_pattern(std::filesystem::path filename_stem_pattern); std::filesystem::path next_filename_stem_matching_pattern(std::filesystem::path filename_stem_pattern);
/* Values added to FatFs FRESULT enum, values outside the FRESULT data type */
static_assert(sizeof(FIL::err) == 1, "FatFs FIL::err size not expected.");
/* Dangerous to expose these, as FatFs native error values are byte-sized. However,
* my filesystem_error implemetation is fine with it. */
#define FR_DISK_FULL (0x100)
#define FR_EOF (0x101)
#define FR_BAD_SEEK (0x102)
#define FR_UNEXPECTED (0x103)
class File { class File {
public: public:
using Size = uint64_t; using Size = uint64_t;