Added setting to change the directory screenshots are stored in

pull/578/head
p4r4digm 5 years ago
parent 7ade0cb2c3
commit 2b54e6216b

@ -657,7 +657,6 @@ private:
};
// Initialise and enter main loop.
void OMW::Engine::go()
{
assert (!mContentFiles.empty());
@ -686,7 +685,8 @@ void OMW::Engine::go()
mViewer->setUseConfigureAffinity(false);
#endif
mScreenCaptureOperation = new WriteScreenshotToFileOperation(mCfgMgr.getUserDataPath().string(),
mScreenCaptureOperation = new WriteScreenshotToFileOperation(
mCfgMgr.getScreenshotPath(Settings::Manager::getString("screenshot path", "General")).string(),
Settings::Manager::getString("screenshot format", "General"));
mScreenCaptureHandler = new osgViewer::ScreenCaptureHandler(mScreenCaptureOperation);

@ -196,4 +196,17 @@ const boost::filesystem::path& ConfigurationManager::getLogPath() const
return mLogPath;
}
const boost::filesystem::path ConfigurationManager::getScreenshotPath(std::string const& screenshotSettings) const
{
boost::filesystem::path ssPath = screenshotSettings;
if (ssPath.is_relative()) {
ssPath = mFixedPath.getUserDataPath() / ssPath;
}
boost::system::error_code dirErr;
if (!boost::filesystem::create_directories(ssPath, dirErr) && !boost::filesystem::is_directory(ssPath)) {
ssPath = mFixedPath.getUserDataPath();
}
return ssPath;
}
} /* namespace Cfg */

@ -41,6 +41,7 @@ struct ConfigurationManager
const boost::filesystem::path& getCachePath() const;
const boost::filesystem::path& getLogPath() const;
const boost::filesystem::path getScreenshotPath(std::string const& screenshotSetting) const;
private:
typedef Files::FixedPath<> FixedPathType;

@ -284,6 +284,9 @@ anisotropy = 4
# File format for screenshots. (jpg, png, tga, and possibly more).
screenshot format = png
# Directory to store screenshots in. Supports relative and absolute paths. Relative paths will be to the user data folder.
screenshot path =./
# Texture magnification filter type. (nearest or linear).
texture mag filter = linear

Loading…
Cancel
Save