summaryrefslogtreecommitdiff
path: root/indra/newview/llviewerwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llviewerwindow.cpp')
-rw-r--r--indra/newview/llviewerwindow.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 2d3b48bab3..a2c5fa2630 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>
@@ -4353,8 +4354,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;
@@ -4398,6 +4401,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;