Skip to content

Commit

Permalink
Merge pull request #104 from Kontiterit/main
Browse files Browse the repository at this point in the history
fix: add back support for MSVC-built GTK in LibLoad
  • Loading branch information
jwharm authored Jun 5, 2024
2 parents 9ea9d91 + c811d38 commit cae677d
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.HashSet;
import java.util.Set;
import java.util.stream.Stream;

/**
Expand Down Expand Up @@ -79,12 +81,16 @@ public static void loadLibrary(String name) {
continue;
}

Set<String> possibleNames = new HashSet<>();
possibleNames.add(name);
if (Platform.getRuntimePlatform().equals("windows") && name.startsWith("lib")) {
possibleNames.add(name.substring(3));
}
// Find the file with the requested library name
for (Path path : files) {
try {
String fn = path.getFileName().toString();
if (fn.equals(name)) {

if (possibleNames.contains(fn)) {
// Load the library
System.load(path.toString());
return;
Expand Down

0 comments on commit cae677d

Please sign in to comment.