feat: android bundling, red/blue exe names, session cache (#3608)

* feat: android bundling

* fix: add hashing to exe names for red/blue exes

* feat: implement session cache for window restoration
This commit is contained in:
Jonathan Kelley authored and GitHub committed 2025-01-20 21:16:55 -08:00
1 parent 024285c548
commit d342630a0a
11 files changed
+334 -185

No files matched your search

+13
View File
@@ -67,6 +67,7 @@ pub const APP_TITLE_ENV: &str = "DIOXUS_APP_TITLE";
#[deprecated(since = "0.6.0", note = "The CLI currently does not set this.")]
#[doc(hidden)]
pub const OUT_DIR: &str = "DIOXUS_OUT_DIR";
pub const SESSION_CACHE_DIR: &str = "DIOXUS_SESSION_CACHE_DIR";
/// Reads an environment variable at runtime in debug mode or at compile time in
/// release mode. When bundling in release mode, we will not be running under the
@@ -277,3 +278,15 @@ pub fn out_dir() -> Option<PathBuf> {
std::env::var(OUT_DIR).ok().map(PathBuf::from)
}
}
/// Get the directory where this app can write to for this session that's guaranteed to be stable
/// between reloads of the same app. This is useful for emitting state like window position and size
/// so the app can restore it when it's next opened.
///
/// Note that this cache dir is really only useful for platforms that can access it. Web/Android
/// don't have access to this directory, so it's not useful for them.
///
/// This is designed with desktop executables in mind.
pub fn session_cache_dir() -> Option<PathBuf> {
std::env::var(SESSION_CACHE_DIR).ok().map(PathBuf::from)
}