Intl: Improve loading libgettextlib #320

Merged
jwharm merged 1 commit from issue-319 into main 2026-01-19 19:43:28 +01:00
jwharm commented 2026-01-17 15:10:59 +01:00 (Migrated from github.com)

This improves the library loading of libgettextlib.so/dll/dylib on Windows and macOS similarly to how it was done for Linux previously.

The custom paths for Linux have been removed; these are now read from "java.library.path" and "javagi.library.path". The template application has been updated to set this.

I added "javagi.library.path" as an alternative to the existing "javagi.path" because I think it's a better name.

Fixes #319

This improves the library loading of libgettextlib.so/dll/dylib on Windows and macOS similarly to how it was done for Linux previously. The custom paths for Linux have been removed; these are now read from "java.library.path" and "javagi.library.path". The template application has been updated to set this. I added "javagi.library.path" as an alternative to the existing "javagi.path" because I think it's a better name. Fixes #319
JFronny (Migrated from github.com) reviewed 2026-01-19 21:11:57 +01:00
@ -45,3 +45,3 @@
static {
String javagiPath = System.getProperty("javagi.path");
String javagiPath = System.getProperty("javagi.path", "javagi.library.path");
String javaPath = System.getProperty("java.library.path");
JFronny (Migrated from github.com) commented 2026-01-19 21:11:57 +01:00

I don't think this is correct.
getProperty is documented to return "the string value of the system property, or the default value if there is no property with that key.", which I interpret to mean that it will return the string literal "javagi.library.path" in this case.
See this jshell session:

jshell> System.getProperty("javagi.path", "javagi.library.path")
$1 ==> "javagi.library.path"

jshell> System.setProperty("javagi.library.path", "some value")
$2 ==> null

jshell> System.getProperty("javagi.path", "javagi.library.path")
$3 ==> "javagi.library.path"

jshell> System.getProperty("javagi.library.path")
$4 ==> "some value"
I don't think this is correct. `getProperty` is documented to return "the string value of the system property, or the default value if there is no property with that key.", which I interpret to mean that it will return the string literal `"javagi.library.path"` in this case. See this jshell session: ``` jshell> System.getProperty("javagi.path", "javagi.library.path") $1 ==> "javagi.library.path" jshell> System.setProperty("javagi.library.path", "some value") $2 ==> null jshell> System.getProperty("javagi.path", "javagi.library.path") $3 ==> "javagi.library.path" jshell> System.getProperty("javagi.library.path") $4 ==> "some value" ```
jwharm (Migrated from github.com) reviewed 2026-01-20 19:59:01 +01:00
@ -45,3 +45,3 @@
static {
String javagiPath = System.getProperty("javagi.path");
String javagiPath = System.getProperty("javagi.path", "javagi.library.path");
String javaPath = System.getProperty("java.library.path");
jwharm (Migrated from github.com) commented 2026-01-20 19:59:00 +01:00

You're right, the property value should have been the fallback, not the property name.
(I think "javagi.library.path" is more logical than "javagi.path", and this way it should not break existing behavior.)

Regrettably I just published a new release candidate yesterday, but I will fix this before the final release.
Thanks for notifying.

You're right, the property value should have been the fallback, not the property name. (I think "javagi.library.path" is more logical than "javagi.path", and this way it should not break existing behavior.) Regrettably I just published a new release candidate yesterday, but I will fix this before the final release. Thanks for notifying.
Sign in to join this conversation.
No description provided.