From 3c190cbb1758bf69e41d37928de5ecdfe7822e1fb677621c0b83730709a6422c Mon Sep 17 00:00:00 2001 From: ADAM David Alan Martin Date: Sat, 31 Oct 2026 18:11:08 -0400 Subject: [PATCH] Fix exception/crash on missing time. Due to stale symlink. I should find a way to check for that earlier. --- cudir.cc | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/cudir.cc b/cudir.cc index 986240a..57317b4 100644 --- a/cudir.cc +++ b/cudir.cc @@ -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;