diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2020-12-28 19:27:38 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2021-01-02 07:21:28 +0100 |
commit | 9862820e04ca259b3e15d1aac858cd46ca936a27 (patch) | |
tree | 617f944edecec36c2e3fb6432d1461b6d300abe8 /jvmfwk | |
parent | 36934e67abce357528aaf0c7d036e77825db27c7 (diff) |
Use Unicode paths on Windows for jvmfwk
Change-Id: I6f2e29d2e7908a40175dc2852e955f0a1bc501e6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108481
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'jvmfwk')
-rw-r--r-- | jvmfwk/source/fwkbase.cxx | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/jvmfwk/source/fwkbase.cxx b/jvmfwk/source/fwkbase.cxx index 501595c6e857..4c4b50725f2c 100644 --- a/jvmfwk/source/fwkbase.cxx +++ b/jvmfwk/source/fwkbase.cxx @@ -45,6 +45,13 @@ static bool g_bJavaSet = false; namespace { +#if defined _WIN32 + // The paths are used in libxml. On Windows, it takes UTF-8 paths. +constexpr rtl_TextEncoding PathEncoding() { return RTL_TEXTENCODING_UTF8; } +#else +rtl_TextEncoding PathEncoding() { return osl_getThreadTextEncoding(); } +#endif + OString getVendorSettingsPath(OUString const & sURL) { if (sURL.isEmpty()) @@ -55,8 +62,7 @@ OString getVendorSettingsPath(OUString const & sURL) throw FrameworkException( JFW_E_ERROR, "[Java framework] Error in function getVendorSettingsPath (fwkbase.cxx) "); - OString osSystemPathSettings = - OUStringToOString(sSystemPathSettings,osl_getThreadTextEncoding()); + OString osSystemPathSettings = OUStringToOString(sSystemPathSettings, PathEncoding()); return osSystemPathSettings; } @@ -239,7 +245,7 @@ OString BootParams::getClasspath() OUString sCP; if (Bootstrap::get()->getFrom( UNO_JAVA_JFW_CLASSPATH, sCP )) { - sClassPath = OUStringToOString(sCP, osl_getThreadTextEncoding()); + sClassPath = OUStringToOString(sCP, PathEncoding()); SAL_INFO( "jfw.level2", "Using bootstrap parameter " UNO_JAVA_JFW_CLASSPATH " = " @@ -456,8 +462,7 @@ OString makeClassPathOption(OUString const & sUserClassPath) sBufCP.append(sAppCP); } - sPaths = OUStringToOString( - sBufCP.makeStringAndClear(), osl_getThreadTextEncoding()); + sPaths = OUStringToOString(sBufCP.makeStringAndClear(), PathEncoding()); OString sOptionClassPath = "-Djava.class.path=" + sPaths; return sOptionClassPath; @@ -483,7 +488,7 @@ OString getSettingsPath( const OUString & sURL) throw FrameworkException( JFW_E_ERROR, "[Java framework] Error in function ::getSettingsPath (fwkbase.cxx)."); - return OUStringToOString(sPath,osl_getThreadTextEncoding()); + return OUStringToOString(sPath, PathEncoding()); } OString getVendorSettingsPath() |