Fix exception/crash on missing time.
Due to stale symlink. I should find a way to check for that earlier.
This commit is contained in:
@@ -20,7 +20,19 @@ getEntries( const std::filesystem::path where )
|
|||||||
|
|
||||||
for( const auto &entry: std::filesystem::directory_iterator{ where } )
|
for( const auto &entry: std::filesystem::directory_iterator{ where } )
|
||||||
{
|
{
|
||||||
const auto time= std::filesystem::file_time_type::clock::to_sys( last_write_time( entry.path() ) );
|
auto time= Alepha::Utility::evaluate <=[&]
|
||||||
|
{
|
||||||
|
using time_type= decltype( std::filesystem::file_time_type::clock::to_sys( last_write_time( entry.path() ) ) );
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return std::filesystem::file_time_type::clock::to_sys( last_write_time( entry.path() ) );
|
||||||
|
}
|
||||||
|
catch( const std::filesystem::filesystem_error & )
|
||||||
|
{
|
||||||
|
time_type rv;
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
};
|
||||||
const auto day= std::chrono::floor< std::chrono::days >( time );
|
const auto day= std::chrono::floor< std::chrono::days >( time );
|
||||||
const std::chrono::year_month_day ymd{ day };
|
const std::chrono::year_month_day ymd{ day };
|
||||||
const auto time_since_midnight= day - time;
|
const auto time_since_midnight= day - time;
|
||||||
|
|||||||
Reference in New Issue
Block a user