From 3e981beab81449cfd48fe91b54f66758fba5a2f6 Mon Sep 17 00:00:00 2001 From: vl Date: Fri, 28 May 2010 16:31:11 +0200 Subject: [PATCH] Fixed: #935 save the screenshots in screenshot directory --- .../src/interface_v3/action_handler_misc.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/code/ryzom/client/src/interface_v3/action_handler_misc.cpp b/code/ryzom/client/src/interface_v3/action_handler_misc.cpp index aa08f1cf6..5c0a53c9b 100644 --- a/code/ryzom/client/src/interface_v3/action_handler_misc.cpp +++ b/code/ryzom/client/src/interface_v3/action_handler_misc.cpp @@ -58,6 +58,9 @@ extern NLMISC::CLog g_log; //////////// //static CCDBNodeLeaf *MenuColorWidgetValue = NULL; // db entry for the color menu widget (Red) + +static const string ScreenshotsDirectory("screenshots/"); // don't forget the final / + void preRenderNewSky (); // *************************************************************************** @@ -596,7 +599,9 @@ void screenShotTGA() { CBitmap btm; getBuffer (btm); - string filename = CFile::findNewFile ("screenshot.tga"); + + if(!ScreenshotsDirectory.empty() && !CFile::isExists(ScreenshotsDirectory)) CFile::createDirectory(ScreenshotsDirectory); + string filename = CFile::findNewFile (ScreenshotsDirectory+"screenshot.tga"); COFile fs(filename); btm.writeTGA(fs, 24, false); nlinfo("Screenshot '%s' saved in tga format (%dx%d)", filename.c_str(), (int) ClientCfg.ScreenShotWidth, (int) ClientCfg.ScreenShotHeight); @@ -607,7 +612,9 @@ void screenShotPNG() { CBitmap btm; getBuffer (btm); - string filename = CFile::findNewFile ("screenshot.png"); + + if(!ScreenshotsDirectory.empty() && !CFile::isExists(ScreenshotsDirectory)) CFile::createDirectory(ScreenshotsDirectory); + string filename = CFile::findNewFile (ScreenshotsDirectory+"screenshot.png"); COFile fs(filename); if (!btm.writePNG(fs, 24)) { @@ -626,7 +633,9 @@ void screenShotJPG() { CBitmap btm; getBuffer (btm); - string filename = CFile::findNewFile ("screenshot.jpg"); + + if(!ScreenshotsDirectory.empty() && !CFile::isExists(ScreenshotsDirectory)) CFile::createDirectory(ScreenshotsDirectory); + string filename = CFile::findNewFile (ScreenshotsDirectory+"screenshot.jpg"); COFile fs(filename); btm.writeJPG(fs); nlinfo("Screenshot '%s' saved in jpg format (%dx%d)", filename.c_str(), (int) ClientCfg.ScreenShotWidth, (int) ClientCfg.ScreenShotHeight);