forked from Mirrorlandia_minetest/minetest
Change screenshot filename to one likely to work on all modern filesystems
Fixes #2603
This commit is contained in:
parent
8804c47e59
commit
43aab618e5
@ -1709,7 +1709,7 @@ void Client::makeScreenshot(IrrlichtDevice *device)
|
|||||||
struct tm *tm = localtime(&t);
|
struct tm *tm = localtime(&t);
|
||||||
|
|
||||||
char timetstamp_c[64];
|
char timetstamp_c[64];
|
||||||
strftime(timetstamp_c, sizeof(timetstamp_c), "%FT%T", tm);
|
strftime(timetstamp_c, sizeof(timetstamp_c), "%Y%m%d_%H%M%S", tm);
|
||||||
|
|
||||||
std::string filename_base = g_settings->get("screenshot_path")
|
std::string filename_base = g_settings->get("screenshot_path")
|
||||||
+ DIR_DELIM
|
+ DIR_DELIM
|
||||||
@ -1722,7 +1722,7 @@ void Client::makeScreenshot(IrrlichtDevice *device)
|
|||||||
unsigned serial = 0;
|
unsigned serial = 0;
|
||||||
|
|
||||||
while (serial < SCREENSHOT_MAX_SERIAL_TRIES) {
|
while (serial < SCREENSHOT_MAX_SERIAL_TRIES) {
|
||||||
filename = filename_base + (serial > 0 ? ("-" + itos(serial)) : "") + filename_ext;
|
filename = filename_base + (serial > 0 ? ("_" + itos(serial)) : "") + filename_ext;
|
||||||
std::ifstream tmp(filename.c_str());
|
std::ifstream tmp(filename.c_str());
|
||||||
if (!tmp.good())
|
if (!tmp.good())
|
||||||
break; // File did not apparently exist, we'll go with it
|
break; // File did not apparently exist, we'll go with it
|
||||||
|
Loading…
Reference in New Issue
Block a user