[Libreoffice-commits] core.git: jvmfwk/source

Mike Kaganski (via logerrit) logerrit at kemper.freedesktop.org
Sat Jan 2 06:22:03 UTC 2021


 jvmfwk/source/fwkbase.cxx |   17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

New commits:
commit 9862820e04ca259b3e15d1aac858cd46ca936a27
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Mon Dec 28 19:27:38 2020 +0300
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Sat Jan 2 07:21:28 2021 +0100

    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 at collabora.com>

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()


More information about the Libreoffice-commits mailing list