-
Notifications
You must be signed in to change notification settings - Fork 430
Open
Labels
Description
Problem
Currently, the Window State plugin saves the .window-state.json
file in a fixed location: ${dataDir}/${bundleIdentifier}/
. This creates issues for applications that need to maintain full portable installations where all data stays in the app/binary directory.
Proposed Solution
Add a with_dir()
method to the Builder
that allows specifying a custom directory for the window state file, similar to how with_filename()
allows custom filenames.
Suggested API:
pub fn with_dir<P: AsRef<std::path::Path>>(self, dir: P) -> Self
Example Usage:
// Relative path
tauri_plugin_window_state::Builder::new()
.with_state_flags(StateFlags::SIZE | StateFlags::POSITION)
.with_dir("./config")
.with_filename("my-window-state.json")
.build()
// Absolute path
tauri_plugin_window_state::Builder::new()
.with_state_flags(StateFlags::SIZE | StateFlags::POSITION)
.with_dir("C:\\Users\\Username\\AppData\\Local\\MyApp")
.with_filename("my-window-state.json")
.build()