Repository navigation
Add support for custom cef framework and subprocess paths - #71
Conversation
|
In // In crates/bevy_cef_render_process/src/main.rs:49
let (_, framework_binary, _) = resolve_custom_cef_paths(None, None);This works when the environment variables are set, but the child process does not appear to pick up the path specified in the parent’s I temporary created
env -u CEF_PATH -u CEF_FRAMEWORK_DIR -u CEF_SUBPROCESS_PATH \
cargo run --example custom_cef_paths --features debug -- \
"$HOME/.local/share/cef" \
"$PWD/target/debug/bevy_cef_render_process"The child process panics inside LibraryLoader::new with a No such file or directory error. One possible fix would be to pass the parent’s resolved path to the child through a command-line argument and read it before loading CEF. If CEF already passes |
|
@not-elm i have added cli argument support for custom cef path |
Problem
bevy_cefexpected CEF framework files and helper binaries to either exist in fixed developer paths (~/.local/share/cef/...with thedebugfeature enabled) or directly adjacent to the main executable in a prebundled app layout. Applications that download or manage CEF dynamically at runtime (e.g. into OS application support directories or custom portable folders) had no way to pointbevy_cefto an arbitrary directory.bevy_cef_render_process,cef::sandbox::Sandbox::new()was called unconditionally on macOS. When running standalone or in setups wherelibcef_sandbox.dylibwas not linked or present at../../../Chromium Embedded Framework.framework/Libraries/libcef_sandbox.dylib, the helper process panicked immediately on startup withOs { code: 2, kind: NotFound }.library_loader::LibraryLoaderfailed to resolve the framework dynamically from custom locations or sibling directory structures.Solution
CefPluginPaths:pub cef_path: Option<PathBuf>andpub subprocess_path: Option<PathBuf>toCefPluginandMessageLoopPlugin.resolve_custom_cef_paths()inbevy_cef_coreto check explicit parameters, falling back toCEF_PATH/CEF_FRAMEWORK_DIRandCEF_SUBPROCESS_PATH..frameworkbundles, and direct binary paths across macOS, Windows, and Linux.CustomLibraryLoaderinbevy_cef_core::debugto loadChromium Embedded Frameworkon macOS from arbitrary file paths at runtime viaload_library.bevy_cef_render_process/src/main.rs, sandbox initialization is now guarded by checking whetherlibcef_sandbox.dylibexists and protected withstd::panic::catch_unwind.Test Pattern
CefPlugin:CEF_PATH="/path/to/custom/cef" cargo run --example simple--type=gpu-process,--type=utility) resolve the framework and initialize cleanly without sandbox missing-library aborts.