Move layout reload policy into platform api
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include "node.h"
|
||||
#include "node_border.h"
|
||||
#include "layout.h"
|
||||
#include "platform_api/asset_file_load_policy.h"
|
||||
|
||||
void LayoutManager::unload()
|
||||
{
|
||||
@@ -22,17 +23,13 @@ void LayoutManager::create()
|
||||
bool LayoutManager::load(const char* path)
|
||||
{
|
||||
auto abs_path = Asset::absolute(path);
|
||||
#if _WIN32 || __OSX__
|
||||
struct stat tmp_info;
|
||||
if (stat(abs_path.c_str(), &tmp_info) != 0)
|
||||
return false;
|
||||
if (tmp_info.st_mtime <= m_file_info.st_mtime)
|
||||
return false;
|
||||
m_file_info = tmp_info;
|
||||
#else
|
||||
if (m_loaded)
|
||||
return true; // already loaded
|
||||
#endif // __ANDROID__
|
||||
const auto file_load = pp::platform::plan_asset_file_load(
|
||||
abs_path,
|
||||
m_loaded,
|
||||
m_file_last_write_time);
|
||||
if (!file_load.should_read_file)
|
||||
return file_load.skipped_load_result;
|
||||
m_file_last_write_time = file_load.last_write_time;
|
||||
|
||||
if (!m_layouts.empty() && on_reloading)
|
||||
on_reloading();
|
||||
|
||||
Reference in New Issue
Block a user