77#include " le_swapchain_img.h"
88#include " le_png.h"
99#include " le_log.h"
10+
1011#include < filesystem>
12+ #include < vector>
13+ #include < string>
1114
1215static constexpr auto LOGGER_LABEL = " le_screenshot" ;
1316
@@ -18,7 +21,6 @@ namespace {
1821#include " shaders/fullscreen_vert.h"
1922} // namespace
2023
21- #include < vector>
2224
2325// ----------------------------------------------------------------------
2426// Default settings for screenshot image swapchain. Copy and modify to
@@ -223,7 +225,7 @@ static bool le_screenshot_record( le_screenshot_o* self, le_rendergraph_o* rg, l
223225 // and start our new screenshots at this offset.
224226
225227 auto target_path = std::filesystem::path ( self->swapchain_settings .image_filename_template ).remove_filename ();
226- std::string ext = std::filesystem::path ( self->swapchain_settings .image_filename_template ).extension ();
228+ std::string ext = std::filesystem::path ( self->swapchain_settings .image_filename_template ).extension (). string () ;
227229 uint32_t largest_number = 0 ;
228230
229231 if ( !std::filesystem::exists ( target_path ) ) {
@@ -238,13 +240,12 @@ static bool le_screenshot_record( le_screenshot_o* self, le_rendergraph_o* rg, l
238240 for ( auto const & f : std::filesystem::directory_iterator{ target_path } ) {
239241 if ( std::filesystem::is_regular_file ( f ) && f.path ().extension () == ext ) {
240242
241- logger.debug ( " Found existing screenshot: %s" , f.path ().c_str () );
242-
243243 uint32_t frame_number = 0 ;
244- const std::string& path = f.path ();
245- char const * const path_c_str = path.c_str ();
244+ std::string tmp_path = f.path ().string ();
245+
246+ logger.debug ( " Found existing screenshot: %s" , tmp_path.c_str () );
246247
247- if ( 1 == sscanf ( path_c_str , self->swapchain_settings .image_filename_template , &frame_number ) ) {
248+ if ( 1 == sscanf ( tmp_path. c_str () , self->swapchain_settings .image_filename_template , &frame_number ) ) {
248249
249250 if ( frame_number >= largest_number ) {
250251 largest_number = frame_number + 1 ;
0 commit comments