Skip to content

Commit

Permalink
pass jcef lib path directly
Browse files Browse the repository at this point in the history
  • Loading branch information
1zun4 committed Mar 12, 2024
1 parent 97a3413 commit a55b19b
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions java/org/cef/CefApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,12 @@
import org.cef.handler.CefAppHandler;
import org.cef.handler.CefAppHandlerAdapter;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
import java.io.File;
import java.io.FilenameFilter;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.HashSet;

import javax.swing.SwingUtilities;
import javax.swing.Timer;

/**
* Exposes static methods for managing the global CEF context.
*/
Expand Down Expand Up @@ -434,23 +429,30 @@ public final void doMessageLoopWork(final long delay_ms) {
* @param args Command-line arguments massed to main().
* @return True on successful startup.
*/
public static final boolean startup(String[] args) {
String jcefPath = getJcefLibPath();
public static final boolean startup(Path librariesPath, String[] args) {
Path jcefPath;
if (OS.isMacintosh()) {
jcefPath = librariesPath.resolve("jcef_app.app/Contents/Java");
} else {
jcefPath = librariesPath;
}

String jcefPathStr = jcefPath.toAbsolutePath().toString();

if (OS.isWindows()) {
System.load(jcefPath + "/d3dcompiler_47.dll");
System.load(jcefPath + "/libGLESv2.dll");
System.load(jcefPath + "/libEGL.dll");
System.load(jcefPath + "/chrome_elf.dll");
System.load(jcefPath + "/libcef.dll");
System.load(jcefPath + "/jcef.dll");
System.load(jcefPathStr + "/d3dcompiler_47.dll");
System.load(jcefPathStr + "/libGLESv2.dll");
System.load(jcefPathStr + "/libEGL.dll");
System.load(jcefPathStr + "/chrome_elf.dll");
System.load(jcefPathStr + "/libcef.dll");
System.load(jcefPathStr + "/jcef.dll");
return true;
} else if (OS.isMacintosh()) {
System.load(jcefPath + "/libjcef.dylib");
System.load(jcefPathStr + "/libjcef.dylib");
return N_Startup(getCefFrameworkPath(args));
} else if (OS.isLinux()) {
System.load(jcefPath + "/libcef.so");
System.load(jcefPath + "/libjcef.so");
System.load(jcefPathStr + "/libcef.so");
System.load(jcefPathStr + "/libjcef.so");
return N_Startup(null);
}

Expand All @@ -461,7 +463,7 @@ public static final boolean startup(String[] args) {
* Get the path which contains the jcef library
* @return The path to the jcef library
*/
private static final String getJcefLibPath() {
private static String getJcefLibPath() {
Path librariesPath = Paths.get(System.getProperty("jcef.path"));
Path jcefPath;

Expand Down

0 comments on commit a55b19b

Please sign in to comment.