diff --git a/firmware/application/file.cpp b/firmware/application/file.cpp index 487e53e4..6ba485d9 100644 --- a/firmware/application/file.cpp +++ b/firmware/application/file.cpp @@ -22,6 +22,8 @@ #include "file.hpp" #include +#include +#include /* Values added to FatFs FRESULT enum, values outside the FRESULT data type */ static_assert(sizeof(FIL::err) == 1, "FatFs FIL::err size not expected."); @@ -210,6 +212,11 @@ std::string filesystem_error::what() const { } } +std::string path_to_string(const path& p) { + std::wstring_convert, path::value_type> conv; + return conv.to_bytes(p); +} + directory_iterator::directory_iterator( std::filesystem::path path, std::filesystem::path wild diff --git a/firmware/application/file.hpp b/firmware/application/file.hpp index bc004015..6c6ab0ee 100644 --- a/firmware/application/file.hpp +++ b/firmware/application/file.hpp @@ -70,6 +70,8 @@ using file_status = BYTE; static_assert(sizeof(path::value_type) == 2, "sizeof(std::filesystem::path::value_type) != 2"); static_assert(sizeof(path::value_type) == sizeof(TCHAR), "FatFs TCHAR size != std::filesystem::path::value_type"); +std::string path_to_string(const path& p); + struct space_info { static_assert(sizeof(std::uintmax_t) >= 8, "std::uintmax_t too small ( -#include -#include - class FileWriter : public Writer { public: FileWriter() = default; @@ -289,10 +286,7 @@ void RecordView::start() { }; if( writer ) { - std::wstring_convert, std::filesystem::path::value_type> conv; - const auto filename_stem_s = conv.to_bytes(filename_stem); - - text_record_filename.set(filename_stem_s); + text_record_filename.set(std::filesystem::path_to_string(filename_stem)); button_record.set_bitmap(&bitmap_stop); capture_thread = std::make_unique( std::move(writer),