|
@@ -66,7 +66,11 @@ struct raw_file_saver::impl {
|
|
|
void handle_file(const file_info &info) {
|
|
void handle_file(const file_info &info) {
|
|
|
static constexpr auto block_size = 512 * 1024; // 512KiB
|
|
static constexpr auto block_size = 512 * 1024; // 512KiB
|
|
|
auto save_file_path = prefix_path / info.file_name;
|
|
auto save_file_path = prefix_path / info.file_name;
|
|
|
|
|
+#ifdef _MSC_VER
|
|
|
|
|
+ auto file = _wfopen(save_file_path.c_str(), L"wb");
|
|
|
|
|
+#else
|
|
|
auto file = fopen(save_file_path.c_str(), "wb");
|
|
auto file = fopen(save_file_path.c_str(), "wb");
|
|
|
|
|
+#endif
|
|
|
assert(file != nullptr);
|
|
assert(file != nullptr);
|
|
|
auto block_cnt = info.length / block_size;
|
|
auto block_cnt = info.length / block_size;
|
|
|
auto write_cnt = fwrite(info.data, block_size, block_cnt, file);
|
|
auto write_cnt = fwrite(info.data, block_size, block_cnt, file);
|
|
@@ -82,7 +86,14 @@ struct raw_file_saver::impl {
|
|
|
void handle_image(const image_info &info) {
|
|
void handle_image(const image_info &info) {
|
|
|
auto img = cv::Mat{info.height, info.width, info.cv_type, info.data};
|
|
auto img = cv::Mat{info.height, info.width, info.cv_type, info.data};
|
|
|
auto save_file_path = prefix_path / info.file_name;
|
|
auto save_file_path = prefix_path / info.file_name;
|
|
|
|
|
+#ifdef _MSC_VER
|
|
|
|
|
+ static constexpr size_t max_file_path_length = 256;
|
|
|
|
|
+ static char file_path_buf[max_file_path_length];
|
|
|
|
|
+ std::wcstombs(file_path_buf, save_file_path.c_str(), max_file_path_length);
|
|
|
|
|
+ cv::imwrite(file_path_buf, img);
|
|
|
|
|
+#else
|
|
|
cv::imwrite(save_file_path, img);
|
|
cv::imwrite(save_file_path, img);
|
|
|
|
|
+#endif
|
|
|
free(info.data);
|
|
free(info.data);
|
|
|
}
|
|
}
|
|
|
|
|
|