Core: POSIX fixes of invalid file handling

This commit is contained in:
Mirek Fidler 2024-11-23 12:01:07 +01:00
parent 696b3fab7f
commit e0275b59cd
3 changed files with 10 additions and 6 deletions

View file

@ -467,11 +467,15 @@ FileTime Time::AsFileTime() const
#ifdef PLATFORM_POSIX #ifdef PLATFORM_POSIX
Time::Time(FileTime filetime) { Time::Time(FileTime filetime) {
struct tm time_r; if(filetime) {
struct tm *time = localtime_r(&filetime.ft, &time_r); struct tm time_r;
if(time) struct tm *time = localtime_r(&filetime.ft, &time_r);
*this = Time(time->tm_year + 1900, time->tm_mon + 1, time->tm_mday, if(time)
time->tm_hour, time->tm_min, time->tm_sec); *this = Time(time->tm_year + 1900, time->tm_mon + 1, time->tm_mday,
time->tm_hour, time->tm_min, time->tm_sec);
}
else
*this = Null;
} }
FileTime Time::AsFileTime() const { FileTime Time::AsFileTime() const {

View file

@ -3,7 +3,7 @@ uses
file file
InvalidFile.cpp, InvalidFile.cpp,
etalon.log; Etalon.log;
mainconfig mainconfig
"" = ""; "" = "";