Skip to content

Commit

Permalink
Merge pull request #89 from orangetangerine/master
Browse files Browse the repository at this point in the history
add auto detect dynamic library by ext name & add os xml tag
  • Loading branch information
Edvin Syse authored Aug 25, 2017
2 parents 460ea5a + 3fe54f0 commit 98cc4f3
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/main/java/fxlauncher/LibraryFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.zip.Adler32;
Expand Down Expand Up @@ -42,8 +41,17 @@ public LibraryFile(Path basepath, Path file) throws IOException {
String filename = file.getFileName().toString().toLowerCase();
Pattern osPattern = Pattern.compile(".+-(linux|win|mac)\\.[^.]+$");
Matcher osMatcher = osPattern.matcher(filename);
if (osMatcher.matches())
this.os = OS.valueOf(osMatcher.group(1));
if (osMatcher.matches()) {
this.os = OS.valueOf(osMatcher.group(1));
} else {
if (filename.endsWith(".dll")) {
this.os = OS.win;
} else if (filename.endsWith(".dylib")) {
this.os = OS.mac;
} else if (filename.endsWith(".so")) {
this.os = OS.linux;
}
}
}

public boolean loadForCurrentPlatform() {
Expand Down

0 comments on commit 98cc4f3

Please sign in to comment.