diff options
| author | Ankur Ahlawat <anchor@lindenlab.com> | 2017-11-16 01:59:00 -0800 |
|---|---|---|
| committer | Ankur Ahlawat <anchor@lindenlab.com> | 2017-11-16 01:59:00 -0800 |
| commit | 93100236ae34eaa9cd3fa314e7e770339c13eba7 (patch) | |
| tree | e384d0f81f46900a95a33d0b6b92cbf285e624bf /indra/newview/llviewerwindow.cpp | |
| parent | a416dee2cc8c802bba24803c43805fd7fa0f484c (diff) | |
| parent | b6d22de58850fc9a5b34eeb5b7930e5845bfc42d (diff) | |
Merged lindenlab/viewer-release into default
Diffstat (limited to 'indra/newview/llviewerwindow.cpp')
| -rw-r--r-- | indra/newview/llviewerwindow.cpp | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 2d3b48bab3..b052a48424 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,22 @@ BOOL LLViewerWindow::saveImageNumbered(LLImageFormatted *image, bool force_picke LLViewerWindow::sSnapshotDir = gDirUtilp->getDirName(filepath); } + if(LLViewerWindow::sSnapshotDir.empty()) + { + return FALSE; + } + +// 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; |
