mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-16 06:38:03 +08:00
* Add native open file dialog * Add native save file dialog * Fix integer underflow in defer message handler * Update nix flake * Cleanup --------- Co-authored-by: Dennis Kobert <dennis@kobert.dev>
23 lines
556 B
Rust
23 lines
556 B
Rust
use std::path::PathBuf;
|
|
|
|
use rfd::AsyncFileDialog;
|
|
|
|
pub(crate) async fn dialog_open_graphite_file() -> Option<PathBuf> {
|
|
AsyncFileDialog::new()
|
|
.add_filter("Graphite", &["graphite"])
|
|
.set_title("Open Graphite Document")
|
|
.pick_file()
|
|
.await
|
|
.map(|f| f.path().to_path_buf())
|
|
}
|
|
|
|
pub(crate) async fn dialog_save_graphite_file(name: String) -> Option<PathBuf> {
|
|
AsyncFileDialog::new()
|
|
.add_filter("Graphite", &["graphite"])
|
|
.set_title("Save Graphite Document")
|
|
.set_file_name(name)
|
|
.save_file()
|
|
.await
|
|
.map(|f| f.path().to_path_buf())
|
|
}
|