diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2017-10-20 12:57:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-20 12:57:25 +0200 |
commit | 2229056fcc2e5a88c9866d0234133fc10f5f2654 (patch) | |
tree | 7cbca98a5c23724e018f8f31ebb4ad3a2ded8b19 /core/io | |
parent | 5f912a9186c3e6267c142cf28ea5aa544ecb19f0 (diff) | |
parent | 27b537cfca161fa41ca7d21539b5bd9f64c9d7c2 (diff) |
Merge pull request #12247 from endragor/fix-rotated-logger
Fix rotated logger naming and backup deletion
[ci skip]
Diffstat (limited to 'core/io')
-rw-r--r-- | core/io/logger.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/core/io/logger.cpp b/core/io/logger.cpp index ad6371f1e1..ce2ce44b1d 100644 --- a/core/io/logger.cpp +++ b/core/io/logger.cpp @@ -110,7 +110,7 @@ void RotatedFileLogger::close_file() { void RotatedFileLogger::clear_old_backups() { int max_backups = max_files - 1; // -1 for the current file - String basename = base_path.get_basename(); + String basename = base_path.get_file().get_basename(); String extension = "." + base_path.get_extension(); DirAccess *da = DirAccess::open(base_path.get_base_dir()); @@ -122,7 +122,7 @@ void RotatedFileLogger::clear_old_backups() { String f = da->get_next(); Set<String> backups; while (f != String()) { - if (!da->current_is_dir() && f.begins_with(basename) && f.ends_with(extension) && f != base_path) { + if (!da->current_is_dir() && f.begins_with(basename) && f.ends_with(extension) && f != base_path.get_file()) { backups.insert(f); } f = da->get_next(); @@ -149,7 +149,7 @@ void RotatedFileLogger::rotate_file() { char timestamp[21]; OS::Date date = OS::get_singleton()->get_date(); OS::Time time = OS::get_singleton()->get_time(); - sprintf(timestamp, "-%04d-%02d-%02d-%02d-%02d-%02d", date.year, date.month, date.day + 1, time.hour, time.min, time.sec); + sprintf(timestamp, "-%04d-%02d-%02d-%02d-%02d-%02d", date.year, date.month, date.day, time.hour, time.min, time.sec); String backup_name = base_path.get_basename() + timestamp + "." + base_path.get_extension(); |