Skip to content

Commit fe27d9d

Browse files
committed
Fix fill_str_dated_filename
1 parent 9c6be8a commit fe27d9d

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

libretro-common/file/file_path.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -608,10 +608,14 @@ size_t fill_str_dated_filename(char *s,
608608
size_t _len = 0;
609609
time_t cur_time = time(NULL);
610610
rtime_localtime(&cur_time, &tm_);
611-
_len = strlcpy(s, in_str, len);
612-
_len += strftime(s + _len, len - _len, "-%y%m%d-%H%M%S", &tm_);
613-
if (ext && *ext != '\0')
614-
_len += strlcpy(s + _len, ext, len - _len);
611+
_len = strlcpy(s, in_str, len);
612+
if (!ext || ext[0] == '\0')
613+
_len += strftime(s + _len, len - _len, "-%y%m%d-%H%M%S", &tm_);
614+
else
615+
{
616+
_len += strftime(s + _len, len - _len, "-%y%m%d-%H%M%S.", &tm_);
617+
_len += strlcpy(s + _len, ext, len - _len);
618+
}
615619
return _len;
616620
}
617621

0 commit comments

Comments
 (0)