Merge pull request #43 from SmilerRyan:beta

Add portable configuration option.
This commit is contained in:
Dmitriy
2024-11-16 18:57:01 +03:00
committed by GitHub
2 changed files with 21 additions and 3 deletions

View File

@@ -188,7 +188,20 @@ fn main() {
.plugin(tauri_plugin_shell::init())
.plugin(
tauri_plugin_window_state::Builder::default()
.with_filename("app-window-state.json")
.with_filename(
if std::env::current_dir()
.ok()
.map(|dir| dir.join("portable.txt").exists())
.unwrap_or(false)
{
std::env::current_dir()
.ok()
.map(|dir| dir.join("UserData/app-window-state.json").to_string_lossy().into_owned())
.unwrap()
} else {
"app-window-state.json".to_string()
},
)
.build(),
)
.setup(|app| {