mirror of
https://github.com/eried/portapack-mayhem.git
synced 2024-12-24 14:59:24 -05:00
File: Extract function to convert path to string.
This commit is contained in:
parent
df0fc30fda
commit
f80706cb34
@ -22,6 +22,8 @@
|
||||
#include "file.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <locale>
|
||||
#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.");
|
||||
@ -210,6 +212,11 @@ std::string filesystem_error::what() const {
|
||||
}
|
||||
}
|
||||
|
||||
std::string path_to_string(const path& p) {
|
||||
std::wstring_convert<std::codecvt_utf8_utf16<path::value_type>, path::value_type> conv;
|
||||
return conv.to_bytes(p);
|
||||
}
|
||||
|
||||
directory_iterator::directory_iterator(
|
||||
std::filesystem::path path,
|
||||
std::filesystem::path wild
|
||||
|
@ -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 (<uint64_t)");
|
||||
|
||||
|
@ -32,9 +32,6 @@ using namespace portapack;
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include <locale>
|
||||
#include <codecvt>
|
||||
|
||||
class FileWriter : public Writer {
|
||||
public:
|
||||
FileWriter() = default;
|
||||
@ -289,10 +286,7 @@ void RecordView::start() {
|
||||
};
|
||||
|
||||
if( writer ) {
|
||||
std::wstring_convert<std::codecvt_utf8_utf16<std::filesystem::path::value_type>, 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<CaptureThread>(
|
||||
std::move(writer),
|
||||
|
Loading…
Reference in New Issue
Block a user