]> git.jsancho.org Git - lugaru.git/commitdiff
Fix creating a Screenshots folder in bindir on Unix
authorRémi Verschelde <rverschelde@gmail.com>
Sun, 20 Nov 2016 12:01:59 +0000 (13:01 +0100)
committerRémi Verschelde <rverschelde@gmail.com>
Sun, 20 Nov 2016 12:01:59 +0000 (13:01 +0100)
Also enhanced the code style a bit.
Fixes #4.

Source/GameTick.cpp

index 1a743f3979536ff84e0a6d6ca002d6932cf472e9..cf93da3d33f3dec49f422e46fe38dd3313011fc2 100644 (file)
@@ -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()