summaryrefslogtreecommitdiff
path: root/helpcompiler/inc
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2020-12-28 19:29:43 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2021-01-01 18:18:38 +0100
commitfed54ff3f2b54ad91650154546a1c5f55d67b859 (patch)
tree74f118a5752b56d0c4c54166a8b66b646b43297c /helpcompiler/inc
parentcbe9a0a815e4a73bf8db425a7c5c651e67b2ed65 (diff)
Use Unicode paths on Windows for help compiler
Change-Id: I4c7a478d457f5e2f5b69a366736c63dec1b31cbb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108482 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'helpcompiler/inc')
-rw-r--r--helpcompiler/inc/HelpCompiler.hxx23
1 files changed, 14 insertions, 9 deletions
diff --git a/helpcompiler/inc/HelpCompiler.hxx b/helpcompiler/inc/HelpCompiler.hxx
index 87390aeedc7e..541f4bc078e5 100644
--- a/helpcompiler/inc/HelpCompiler.hxx
+++ b/helpcompiler/inc/HelpCompiler.hxx
@@ -59,21 +59,19 @@ namespace fs
{
OUString sWorkingDir;
osl_getProcessWorkingDir(&sWorkingDir.pData);
- OString tmp(in.c_str());
- OUString ustrSystemPath(OStringToOUString(tmp, osl_getThreadTextEncoding()));
+ OUString ustrSystemPath(OStringToOUString(in, FileNameEnc()));
osl::File::getFileURLFromSystemPath(ustrSystemPath, data);
(void)osl::File::getAbsoluteFileURL(sWorkingDir, data, data);
}
path(const std::string &FileURL)
{
- OString tmp(FileURL.c_str());
- data = OStringToOUString(tmp, osl_getThreadTextEncoding());
+ data = OStringToOUString(FileURL, FileNameEnc());
}
std::string native_file_string() const
{
OUString ustrSystemPath;
osl::File::getSystemPathFromFileURL(data, ustrSystemPath);
- OString tmp(OUStringToOString(ustrSystemPath, osl_getThreadTextEncoding()));
+ OString tmp(OUStringToOString(ustrSystemPath, FileNameEnc()));
HCDBG(std::cerr << "native_file_string is " << tmp.getStr() << std::endl);
return std::string(tmp.getStr());
}
@@ -96,8 +94,7 @@ namespace fs
path ret(*this);
HCDBG(std::cerr << "orig was " <<
OUStringToOString(ret.data, RTL_TEXTENCODING_UTF8).getStr() << std::endl);
- OString tmp(in.c_str());
- OUString ustrSystemPath(OStringToOUString(tmp, osl_getThreadTextEncoding()));
+ OUString ustrSystemPath(OStringToOUString(in, FileNameEnc()));
ret.data += "/" + ustrSystemPath;
HCDBG(std::cerr << "final is " <<
OUStringToOString(ret.data, RTL_TEXTENCODING_UTF8).getStr() << std::endl);
@@ -105,11 +102,19 @@ namespace fs
}
void append(const char *in)
{
- OString tmp(in);
- OUString ustrSystemPath(OStringToOUString(tmp, osl_getThreadTextEncoding()));
+ OUString ustrSystemPath(OStringToOUString(in, FileNameEnc()));
data += ustrSystemPath;
}
void append(const std::string &in) { append(in.c_str()); }
+
+ private:
+#ifdef _WIN32
+ // On Windows, libxslt and libxml use UTF-8 path strings
+ static constexpr rtl_TextEncoding FileNameEnc() { return RTL_TEXTENCODING_UTF8; }
+#else
+ static rtl_TextEncoding FileNameEnc() { return osl_getThreadTextEncoding(); }
+#endif
+
};
void create_directory(const fs::path& indexDirName);