Skip to content
Snippets Groups Projects
Commit 06d7845a authored by Nyx Linden's avatar Nyx Linden
Browse files

SUN-72 SH-4132 FIX viewer builds cannot write to paths containing special characters.

Integrated Nicky Dasmijn's patch to handle the unicode file paths properly.
Code reviewed, patch was clean.
Tested locally, correctly allows wearables to load where they would fail before.
Should be ready for automated build & QA.
parent 490edf41
No related branches found
No related tags found
No related merge requests found
...@@ -899,6 +899,7 @@ NickyD ...@@ -899,6 +899,7 @@ NickyD
Nicky Dasmijn Nicky Dasmijn
VWR-29228 VWR-29228
MAINT-873 MAINT-873
SUN-72
Nicky Perian Nicky Perian
OPEN-1 OPEN-1
STORM-1087 STORM-1087
......
...@@ -853,7 +853,8 @@ llifstream::llifstream(const std::string& _Filename, ...@@ -853,7 +853,8 @@ llifstream::llifstream(const std::string& _Filename,
#if LL_WINDOWS #if LL_WINDOWS
std::istream(&_M_filebuf) std::istream(&_M_filebuf)
{ {
if (_M_filebuf.open(_Filename.c_str(), _Mode | ios_base::in) == 0) llutf16string wideName = utf8str_to_utf16str( _Filename );
if (_M_filebuf.open(wideName.c_str(), _Mode | ios_base::in) == 0)
{ {
_Myios::setstate(ios_base::failbit); _Myios::setstate(ios_base::failbit);
} }
...@@ -872,7 +873,8 @@ llifstream::llifstream(const char* _Filename, ...@@ -872,7 +873,8 @@ llifstream::llifstream(const char* _Filename,
#if LL_WINDOWS #if LL_WINDOWS
std::istream(&_M_filebuf) std::istream(&_M_filebuf)
{ {
if (_M_filebuf.open(_Filename, _Mode | ios_base::in) == 0) llutf16string wideName = utf8str_to_utf16str( _Filename );
if (_M_filebuf.open(wideName.c_str(), _Mode | ios_base::in) == 0)
{ {
_Myios::setstate(ios_base::failbit); _Myios::setstate(ios_base::failbit);
} }
...@@ -917,8 +919,10 @@ bool llifstream::is_open() const ...@@ -917,8 +919,10 @@ bool llifstream::is_open() const
void llifstream::open(const char* _Filename, ios_base::openmode _Mode) void llifstream::open(const char* _Filename, ios_base::openmode _Mode)
{ // open a C stream with specified mode { // open a C stream with specified mode
if (_M_filebuf.open(_Filename, _Mode | ios_base::in) == 0)
#if LL_WINDOWS #if LL_WINDOWS
llutf16string wideName = utf8str_to_utf16str( _Filename );
if (_M_filebuf.open( wideName.c_str(), _Mode | ios_base::in) == 0)
{ {
_Myios::setstate(ios_base::failbit); _Myios::setstate(ios_base::failbit);
} }
...@@ -927,6 +931,7 @@ void llifstream::open(const char* _Filename, ios_base::openmode _Mode) ...@@ -927,6 +931,7 @@ void llifstream::open(const char* _Filename, ios_base::openmode _Mode)
_Myios::clear(); _Myios::clear();
} }
#else #else
if (_M_filebuf.open(_Filename, _Mode | ios_base::in) == 0)
{ {
this->setstate(ios_base::failbit); this->setstate(ios_base::failbit);
} }
...@@ -969,7 +974,8 @@ llofstream::llofstream(const std::string& _Filename, ...@@ -969,7 +974,8 @@ llofstream::llofstream(const std::string& _Filename,
#if LL_WINDOWS #if LL_WINDOWS
std::ostream(&_M_filebuf) std::ostream(&_M_filebuf)
{ {
if (_M_filebuf.open(_Filename.c_str(), _Mode | ios_base::out) == 0) llutf16string wideName = utf8str_to_utf16str( _Filename );
if (_M_filebuf.open( wideName.c_str(), _Mode | ios_base::out) == 0)
{ {
_Myios::setstate(ios_base::failbit); _Myios::setstate(ios_base::failbit);
} }
...@@ -988,7 +994,8 @@ llofstream::llofstream(const char* _Filename, ...@@ -988,7 +994,8 @@ llofstream::llofstream(const char* _Filename,
#if LL_WINDOWS #if LL_WINDOWS
std::ostream(&_M_filebuf) std::ostream(&_M_filebuf)
{ {
if (_M_filebuf.open(_Filename, _Mode | ios_base::out) == 0) llutf16string wideName = utf8str_to_utf16str( _Filename );
if (_M_filebuf.open( wideName.c_str(), _Mode | ios_base::out) == 0)
{ {
_Myios::setstate(ios_base::failbit); _Myios::setstate(ios_base::failbit);
} }
...@@ -1032,8 +1039,9 @@ bool llofstream::is_open() const ...@@ -1032,8 +1039,9 @@ bool llofstream::is_open() const
void llofstream::open(const char* _Filename, ios_base::openmode _Mode) void llofstream::open(const char* _Filename, ios_base::openmode _Mode)
{ // open a C stream with specified mode { // open a C stream with specified mode
if (_M_filebuf.open(_Filename, _Mode | ios_base::out) == 0)
#if LL_WINDOWS #if LL_WINDOWS
llutf16string wideName = utf8str_to_utf16str( _Filename );
if (_M_filebuf.open( wideName.c_str(), _Mode | ios_base::out) == 0)
{ {
_Myios::setstate(ios_base::failbit); _Myios::setstate(ios_base::failbit);
} }
...@@ -1042,6 +1050,7 @@ void llofstream::open(const char* _Filename, ios_base::openmode _Mode) ...@@ -1042,6 +1050,7 @@ void llofstream::open(const char* _Filename, ios_base::openmode _Mode)
_Myios::clear(); _Myios::clear();
} }
#else #else
if (_M_filebuf.open(_Filename, _Mode | ios_base::out) == 0)
{ {
this->setstate(ios_base::failbit); this->setstate(ios_base::failbit);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment