mirror of
https://github.com/emilk/egui.git
synced 2026-08-30 13:20:05 -04:00
eframe: Add NativeOptions::persistence_path (#4423)
This allows customizing the persistence path in NativeOptions. Previously, persistence wouldn't work with android because directories-next doesn't support android so eframe would just fail to find a place where it could store its config. * Closes #4098 (android users can now specify a path that works with android, by e.g. using app_dirs2, which supports android)
This commit is contained in:
@@ -406,13 +406,17 @@ impl WinitApp for WgpuWinitApp {
|
||||
self.recreate_window(event_loop, running);
|
||||
running
|
||||
} else {
|
||||
let storage = epi_integration::create_storage(
|
||||
self.native_options
|
||||
.viewport
|
||||
.app_id
|
||||
.as_ref()
|
||||
.unwrap_or(&self.app_name),
|
||||
);
|
||||
let storage = if let Some(file) = &self.native_options.persistence_path {
|
||||
epi_integration::create_storage_with_file(file)
|
||||
} else {
|
||||
epi_integration::create_storage(
|
||||
self.native_options
|
||||
.viewport
|
||||
.app_id
|
||||
.as_ref()
|
||||
.unwrap_or(&self.app_name),
|
||||
)
|
||||
};
|
||||
let egui_ctx = winit_integration::create_egui_context(storage.as_deref());
|
||||
let (window, builder) = create_window(
|
||||
&egui_ctx,
|
||||
|
||||
Reference in New Issue
Block a user