From 3f82bb3e804d1a6950bf71be8fe2ac008d1cb954 Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C3=A9mi=20Verschelde?= Date: Sun, 20 Nov 2016 13:01:59 +0100 Subject: [PATCH] Fix creating a Screenshots folder in bindir on Unix Also enhanced the code style a bit. Fixes #4. --- Source/GameTick.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Source/GameTick.cpp b/Source/GameTick.cpp index 1a743f3..cf93da3 100644 --- a/Source/GameTick.cpp +++ b/Source/GameTick.cpp @@ -1322,18 +1322,17 @@ static void cmd_dispatch(const string cmd) extern bool save_image(const char * fname); void Screenshot (void) { - char temp[1024]; + char filename[1024]; time_t t = time(NULL); struct tm *tme = localtime(&t); - sprintf(temp, "Screenshots/Screenshot_%04d_%02d_%02d--%02d_%02d_%02d.png", tme->tm_year + 1900, tme->tm_mon + 1, tme->tm_mday, tme->tm_hour, tme->tm_min, tme->tm_sec); + sprintf(filename, "Screenshots/Screenshot-%04d%02d%02d-%02d%02d%02d.png", + tme->tm_year + 1900, tme->tm_mon + 1, tme->tm_mday, tme->tm_hour, tme->tm_min, tme->tm_sec); #if defined(_WIN32) mkdir("Screenshots"); -#else - mkdir("Screenshots", S_IRWXU); #endif - save_image(temp); + save_image(filename); } void Game::SetUpLighting() -- 2.39.2