Skip to content

Commit

Permalink
Check if debug.log exists
Browse files Browse the repository at this point in the history
  • Loading branch information
alef committed Jan 30, 2025
1 parent f510ba6 commit 2d2a3b9
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,8 @@ void DebugFile::init( DebugOutput output_mode, const cata_path &filename )
this->filename = filename;
// Continue with the old log file if it's smaller than 1 MiB
namespace fs = std::filesystem;
if( fs::file_size( fs::path( filename ) ) >= 1024 * 1024 ) {
if( fs::exists( fs::path( filename ) )
&& fs::file_size( fs::path( filename ) ) >= 1024 * 1024 ) {
std::error_code ec;
fs::rename( fs::path( filename ), fs::path( oldfile ), ec );
rename_failed = bool( ec );
Expand Down

0 comments on commit 2d2a3b9

Please sign in to comment.