Route recording cleanup through platform services
This commit is contained in:
10
src/app.cpp
10
src/app.cpp
@@ -759,18 +759,12 @@ void App::rec_clear()
|
||||
{
|
||||
const auto plan = pp::app::plan_recording_clear(
|
||||
rec_running,
|
||||
#if defined(__IOS__) || defined(__OSX__)
|
||||
true
|
||||
#else
|
||||
false
|
||||
#endif
|
||||
platform_deletes_recorded_files_on_clear()
|
||||
);
|
||||
if (plan.stop_running_recording)
|
||||
rec_stop();
|
||||
#if defined(__IOS__) || defined(__OSX__)
|
||||
if (plan.delete_recorded_files)
|
||||
delete_all_files_in_path(rec_path);
|
||||
#endif
|
||||
clear_platform_recorded_files(rec_path);
|
||||
rec_count = plan.frame_count_after_clear;
|
||||
update_rec_frames();
|
||||
}
|
||||
|
||||
@@ -198,6 +198,8 @@ public:
|
||||
void present_render_context();
|
||||
void begin_render_capture_frame();
|
||||
void end_render_capture_frame();
|
||||
[[nodiscard]] bool platform_deletes_recorded_files_on_clear();
|
||||
void clear_platform_recorded_files(std::string path);
|
||||
void update_platform_frame(float delta_time_seconds);
|
||||
void report_rendered_frames(int frames);
|
||||
void save_prepared_file(
|
||||
|
||||
@@ -259,6 +259,16 @@ void App::end_render_capture_frame()
|
||||
active_platform_services().end_render_capture_frame();
|
||||
}
|
||||
|
||||
bool App::platform_deletes_recorded_files_on_clear()
|
||||
{
|
||||
return active_platform_services().deletes_recorded_files_on_clear();
|
||||
}
|
||||
|
||||
void App::clear_platform_recorded_files(std::string path)
|
||||
{
|
||||
active_platform_services().clear_recorded_files(path);
|
||||
}
|
||||
|
||||
void App::update_platform_frame(float delta_time_seconds)
|
||||
{
|
||||
active_platform_services().update_platform_frame(delta_time_seconds);
|
||||
|
||||
@@ -33,6 +33,8 @@ public:
|
||||
virtual void present_render_context() = 0;
|
||||
virtual void begin_render_capture_frame() = 0;
|
||||
virtual void end_render_capture_frame() = 0;
|
||||
[[nodiscard]] virtual bool deletes_recorded_files_on_clear() = 0;
|
||||
virtual void clear_recorded_files(std::string_view recording_path) = 0;
|
||||
virtual void update_platform_frame(float delta_time_seconds) = 0;
|
||||
virtual void report_rendered_frames(int frames) = 0;
|
||||
virtual void display_file(std::string_view path) = 0;
|
||||
|
||||
@@ -16,6 +16,7 @@ void android_pick_file_save(std::function<void(std::string)> callback);
|
||||
std::string android_get_clipboard();
|
||||
bool android_set_clipboard(const std::string& s);
|
||||
#elif __APPLE__
|
||||
void delete_all_files_in_path(const std::string& source_path);
|
||||
#elif __LINUX__
|
||||
#include <tinyfiledialogs.h>
|
||||
std::string linux_home_path();
|
||||
@@ -211,6 +212,24 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
[[nodiscard]] bool deletes_recorded_files_on_clear() override
|
||||
{
|
||||
#if defined(__IOS__) || defined(__OSX__)
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
void clear_recorded_files(std::string_view recording_path) override
|
||||
{
|
||||
#if defined(__IOS__) || defined(__OSX__)
|
||||
delete_all_files_in_path(std::string(recording_path));
|
||||
#else
|
||||
(void)recording_path;
|
||||
#endif
|
||||
}
|
||||
|
||||
void update_platform_frame(float delta_time_seconds) override
|
||||
{
|
||||
(void)delta_time_seconds;
|
||||
|
||||
@@ -251,6 +251,16 @@ public:
|
||||
win32_renderdoc_frame_end();
|
||||
}
|
||||
|
||||
[[nodiscard]] bool deletes_recorded_files_on_clear() override
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void clear_recorded_files(std::string_view recording_path) override
|
||||
{
|
||||
(void)recording_path;
|
||||
}
|
||||
|
||||
void update_platform_frame(float delta_time_seconds) override
|
||||
{
|
||||
win32_update_stylus(delta_time_seconds);
|
||||
|
||||
Reference in New Issue
Block a user