diff options
Diffstat (limited to 'indra/newview/llviewerwindow.cpp')
-rw-r--r-- | indra/newview/llviewerwindow.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index feed5ba43d..a96cede739 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -33,6 +33,7 @@ #include <iostream> #include <fstream> #include <algorithm> +#include <boost/filesystem.hpp> #include <boost/lambda/core.hpp> #include <boost/regex.hpp> @@ -4355,8 +4356,10 @@ BOOL LLViewerWindow::mousePointOnLandGlobal(const S32 x, const S32 y, LLVector3d } // Saves an image to the harddrive as "SnapshotX" where X >= 1. -BOOL LLViewerWindow::saveImageNumbered(LLImageFormatted *image, bool force_picker) +BOOL LLViewerWindow::saveImageNumbered(LLImageFormatted *image, BOOL force_picker, BOOL& insufficient_memory) { + insufficient_memory = FALSE; + if (!image) { LL_WARNS() << "No image to save" << LL_ENDL; @@ -4400,6 +4403,17 @@ BOOL LLViewerWindow::saveImageNumbered(LLImageFormatted *image, bool force_picke LLViewerWindow::sSnapshotDir = gDirUtilp->getDirName(filepath); } +// Check if there is enough free space to save snapshot +#ifdef LL_WINDOWS + boost::filesystem::space_info b_space = boost::filesystem::space(utf8str_to_utf16str(sSnapshotDir)); +#else + boost::filesystem::space_info b_space = boost::filesystem::space(sSnapshotDir); +#endif + if (b_space.free < image->getDataSize()) + { + insufficient_memory = TRUE; + return FALSE; + } // Look for an unused file name std::string filepath; S32 i = 1; |