diff options
author | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2017-08-31 16:48:49 +0100 |
---|---|---|
committer | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2017-08-31 16:48:49 +0100 |
commit | 57bb63bafd2adc744ea8cab63593abd90c7199df (patch) | |
tree | 94ec221ca06ce32dee7e6138d655d8a575a46a23 /indra/newview/llviewerwindow.cpp | |
parent | 936ccff59f2045f5747a0730570784608f39a7b4 (diff) | |
parent | 218584593a7815f7494be58a7b36774c47fd047f (diff) |
merge
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 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; |