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:
2026-10-31 18:11:08 -04:00
parent 4574a022a7
commit 3c190cbb17
+13 -1
View File
@@ -20,7 +20,19 @@ getEntries( const std::filesystem::path 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 std::chrono::year_month_day ymd{ day };
const auto time_since_midnight= day - time;