Widnows: Proper path handling for utf8 paths

Nicky 2016-01-30 23:41:14 +01:00
parent f3fea60caf
commit e4a639bc48
1 changed files with 24 additions and 2 deletions

View File

@ -1349,7 +1349,18 @@ BOOL gunzip_file(const std::string& srcfile, const std::string& dstfile)
LLFILE *dst = NULL;
S32 bytes = 0;
tmpfile = dstfile + ".t";
src = gzopen(srcfile.c_str(), "rb");
// <FS:ND> Proper UTF8->UTF16 handling for Windows
// src = gzopen(srcfile.c_str(), "rb");
#if LL_WINDOWS
std::string utf8filename = srcfile;
llutf16string utf16filename = utf8str_to_utf16str(utf8filename);
src = gzopen_w(utf16filename.c_str(), "rb");
#else
src = gzopen(srcfile.c_str(), "rb");/* Flawfinder: ignore */
#endif
// </FS:ND>
if (! src) goto err;
dst = LLFile::fopen(tmpfile, "wb"); /* Flawfinder: ignore */
if (! dst) goto err;
@ -1383,7 +1394,18 @@ BOOL gzip_file(const std::string& srcfile, const std::string& dstfile)
LLFILE *src = NULL;
S32 bytes = 0;
tmpfile = dstfile + ".t";
dst = gzopen(tmpfile.c_str(), "wb"); /* Flawfinder: ignore */
// <FS:ND> Proper UTF8->UTF16 handling for Windows
// dst = gzopen(tmpfile.c_str(), "wb"); /* Flawfinder: ignore */
#if LL_WINDOWS
std::string utf8filename = tmpfile;
llutf16string utf16filename = utf8str_to_utf16str(utf8filename);
dst = gzopen_w(utf16filename.c_str(), "wb");
#else
dst = gzopen(tmpfile.c_str(), "wb");/* Flawfinder: ignore */
#endif
// </FS:ND>
if (! dst) goto err;
src = LLFile::fopen(srcfile, "rb"); /* Flawfinder: ignore */
if (! src) goto err;