summaryrefslogtreecommitdiff
path: root/indra/newview/llfloater360capture.cpp
diff options
context:
space:
mode:
authorMnikolenko Productengine <mnikolenko@productengine.com>2021-09-02 16:34:30 +0300
committerMnikolenko Productengine <mnikolenko@productengine.com>2021-09-02 16:34:30 +0300
commitd41dd19f18bc41962904225e2bbdfbca4e85370a (patch)
tree8ebcfcdef7df5aacdbeef5d038e6046d27e2273d /indra/newview/llfloater360capture.cpp
parent27c9e0347fc974e6555b2385453b958d3d8258f7 (diff)
SL-15934 fixed issue with saving image to the folder with non-ascii name
Diffstat (limited to 'indra/newview/llfloater360capture.cpp')
-rw-r--r--indra/newview/llfloater360capture.cpp17
1 files changed, 14 insertions, 3 deletions
diff --git a/indra/newview/llfloater360capture.cpp b/indra/newview/llfloater360capture.cpp
index addcfaa611..101686e0c7 100644
--- a/indra/newview/llfloater360capture.cpp
+++ b/indra/newview/llfloater360capture.cpp
@@ -336,6 +336,17 @@ const std::string LLFloater360Capture::makeFullPathToJS(const std::string filena
return full_js_path;
}
+const wchar_t *get_filename_char(const std::string filename)
+{
+#if LL_WINDOWS
+ std::wstring filename_wstr(utf8str_to_utf16str(filename));
+#else
+ std::string filename_wstr(filename);
+#endif
+
+ return filename_wstr.c_str();
+}
+
// Write the header/prequel portion of the JavaScript array of data urls
// that we use to store the cube map images in (so the web code can load
// them without tweaking browser security - we'd have to do this if they
@@ -343,7 +354,7 @@ const std::string LLFloater360Capture::makeFullPathToJS(const std::string filena
// one, if it exists
void LLFloater360Capture::writeDataURLHeader(const std::string filename)
{
- std::ofstream file_handle(filename.c_str());
+ std::ofstream file_handle(get_filename_char(filename));
if (file_handle.is_open())
{
file_handle << "// cube map images for Second Life Viewer panorama 360 images" << std::endl;
@@ -358,7 +369,7 @@ void LLFloater360Capture::writeDataURLHeader(const std::string filename)
// reference and read.
void LLFloater360Capture::writeDataURLFooter(const std::string filename)
{
- std::ofstream file_handle(filename.c_str(), std::ios_base::app);
+ std::ofstream file_handle(get_filename_char(filename), std::ios_base::app);
if (file_handle.is_open())
{
file_handle << "var cubemap_img_js = [" << std::endl;
@@ -380,7 +391,7 @@ bool LLFloater360Capture::writeDataURL(const std::string filename, const std::st
const std::string data_url = LLBase64::encode(data, data_len);
- std::ofstream file_handle(filename.c_str(), std::ios_base::app);
+ std::ofstream file_handle(get_filename_char(filename), std::ios_base::app);
if (file_handle.is_open())
{
file_handle << "var img_";