Compare commits

...

2 Commits

Author SHA1 Message Date
Michael Pfaff b184525212
Cleanup library resolution logic 2022-11-19 00:00:14 -05:00
Michael Pfaff b78e44c3bd
Add +NoGen suffix to build.sh 2022-11-19 00:00:05 -05:00
2 changed files with 11 additions and 13 deletions

View File

@ -10,7 +10,7 @@ export JAVA_HOME=${JAVA_HOME:-`asdf where java`}
ant generate-all
ant compile
ant compile+NoGen
ant compile_native
ant compile_native+NoGen

View File

@ -198,6 +198,15 @@ public class LWJGLUtil {
* @return Paths to located libraries, if any
*/
public static String[] getLibraryPaths(String libname, String[] platform_lib_names, ClassLoader classloader) {
String overridePath = getPrivilegedProperty("org.lwjgl.librarypath");
if (overridePath != null) {
String[] paths = new String[platform_lib_names.length];
for (int i = 0; i < paths.length; i++) {
paths[i] = overridePath + File.separator + platform_lib_names[i];
}
return paths;
}
// need to pass path of possible locations of library to native side
List<String> possible_paths = new ArrayList<String>();
@ -220,12 +229,6 @@ public class LWJGLUtil {
+ File.separator + platform_lib_name);
}
// add Installer path
String alternative_path = getPrivilegedProperty("org.lwjgl.librarypath");
if ( alternative_path != null ) {
possible_paths.add(alternative_path + File.separator + platform_lib_name);
}
// Add all possible paths from java.library.path
String java_library_path = getPrivilegedProperty("java.library.path");
@ -235,11 +238,6 @@ public class LWJGLUtil {
possible_paths.add(path + File.separator + platform_lib_name);
}
// TODO: this can be very dangerous (see recent (2022-08) use of completely safe notepad.exe to load a malicious dll)
//add current path
String current_dir = getPrivilegedProperty("user.dir");
possible_paths.add(current_dir + File.separator + platform_lib_name);
//add pure library (no path, let OS search)
possible_paths.add(platform_lib_name);
}