Skip to content

Commit

Permalink
Save screenshots in "screenshots/" subdirectory
Browse files Browse the repository at this point in the history
TODO: Cross-platform global dir for screenshots
  • Loading branch information
Dasperal committed Jan 3, 2024
1 parent e650c90 commit 9101ac3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/v_video.c
Original file line number Diff line number Diff line change
Expand Up @@ -2009,7 +2009,7 @@ void WritePNGfile(char *filename)
void V_ScreenShot (const char *format)
{
int i;
char lbmname[32]; // haleyjd 20110213: BUG FIX - 12 is too small!
char lbmname[44] = "screenshots/"; // haleyjd 20110213: BUG FIX - 12 is too small!
char *ext; // [JN] lbmname extended from 16 to 32

// find a file name to save it to
Expand All @@ -2025,7 +2025,7 @@ void V_ScreenShot (const char *format)

for (i=0; i<=9999; i++) // [crispy] increase screenshot filename limit
{
M_snprintf(lbmname, sizeof(lbmname), format, i, ext);
M_snprintf(lbmname + 12, sizeof(lbmname), format, i, ext);

if (!M_FileExists(lbmname))
{
Expand All @@ -2049,6 +2049,8 @@ void V_ScreenShot (const char *format)
}
}

M_MakeDirectory("screenshots");

if(png_screenshots)
{
WritePNGfile(lbmname);
Expand Down

0 comments on commit 9101ac3

Please sign in to comment.