diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index 4a66f3a7a..7d6348789 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -658,7 +658,6 @@ private: }; // Initialise and enter main loop. - void OMW::Engine::go() { assert (!mContentFiles.empty()); @@ -687,7 +686,8 @@ void OMW::Engine::go() mViewer->setUseConfigureAffinity(false); #endif - mScreenCaptureOperation = new WriteScreenshotToFileOperation(mCfgMgr.getUserDataPath().string(), + mScreenCaptureOperation = new WriteScreenshotToFileOperation( + mCfgMgr.getScreenshotPath().string(), Settings::Manager::getString("screenshot format", "General")); mScreenCaptureHandler = new osgViewer::ScreenCaptureHandler(mScreenCaptureOperation); diff --git a/components/files/configurationmanager.cpp b/components/files/configurationmanager.cpp index 3bc6e1772..0ba2d1519 100644 --- a/components/files/configurationmanager.cpp +++ b/components/files/configurationmanager.cpp @@ -32,6 +32,14 @@ ConfigurationManager::ConfigurationManager(bool silent) boost::filesystem::create_directories(mFixedPath.getUserDataPath()); mLogPath = mFixedPath.getUserConfigPath(); + + mScreenshotPath = mFixedPath.getUserDataPath() / "screenshots"; + + // probably not necessary but validate the creation of the screenshots directory and fallback to the original behavior if it fails + boost::system::error_code dirErr; + if (!boost::filesystem::create_directories(mScreenshotPath, dirErr) && !boost::filesystem::is_directory(mScreenshotPath)) { + mScreenshotPath = mFixedPath.getUserDataPath(); + } } ConfigurationManager::~ConfigurationManager() @@ -196,4 +204,9 @@ const boost::filesystem::path& ConfigurationManager::getLogPath() const return mLogPath; } +const boost::filesystem::path& ConfigurationManager::getScreenshotPath() const +{ + return mScreenshotPath; +} + } /* namespace Cfg */ diff --git a/components/files/configurationmanager.hpp b/components/files/configurationmanager.hpp index df131e671..446abd4dc 100644 --- a/components/files/configurationmanager.hpp +++ b/components/files/configurationmanager.hpp @@ -41,6 +41,7 @@ struct ConfigurationManager const boost::filesystem::path& getCachePath() const; const boost::filesystem::path& getLogPath() const; + const boost::filesystem::path& getScreenshotPath() const; private: typedef Files::FixedPath<> FixedPathType; @@ -57,6 +58,7 @@ struct ConfigurationManager FixedPathType mFixedPath; boost::filesystem::path mLogPath; + boost::filesystem::path mScreenshotPath; TokensMappingContainer mTokensMapping;