From: RĂ©mi Verschelde Date: Sun, 20 Nov 2016 12:01:59 +0000 (+0100) Subject: Fix creating a Screenshots folder in bindir on Unix X-Git-Url: https://git.jsancho.org/?a=commitdiff_plain;h=3f82bb3e804d1a6950bf71be8fe2ac008d1cb954;p=lugaru.git Fix creating a Screenshots folder in bindir on Unix Also enhanced the code style a bit. Fixes #4. --- 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()