Skip to content

Commit 33ec893

Browse files
committed
Fix savestate thumbnails - '.png' needs to be appended to the total
filepath, so fill_pathname can't be used since it would overwrite the existing extension
1 parent 3a43302 commit 33ec893

1 file changed

Lines changed: 15 additions & 5 deletions

File tree

tasks/task_screenshot.c

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,13 @@ static bool screenshot_dump(
307307
if (!fullpath)
308308
{
309309
if (savestate)
310-
fill_pathname(state->filename,
311-
name_base, ".png", sizeof(state->filename));
310+
{
311+
size_t _len = strlcpy(state->filename,
312+
name_base, sizeof(state->filename));
313+
strlcpy(state->filename + _len,
314+
".png",
315+
sizeof(state->filename) - _len);
316+
}
312317
else
313318
{
314319
char new_screenshot_dir[DIR_MAX_LENGTH];
@@ -361,9 +366,14 @@ static bool screenshot_dump(
361366
IMG_EXT, sizeof(state->shotname));
362367
}
363368
else
364-
fill_pathname(state->shotname,
365-
path_basename_nocompression(name_base),
366-
".png", sizeof(state->shotname));
369+
{
370+
size_t _len = strlcpy(state->shotname,
371+
path_basename_nocompression(name_base),
372+
sizeof(state->shotname));
373+
strlcpy(state->shotname + _len,
374+
".png",
375+
sizeof(state->shotname) - _len);
376+
}
367377

368378
if ( string_is_empty(new_screenshot_dir)
369379
|| settings->bools.screenshots_in_content_dir)

0 commit comments

Comments
 (0)