Save to Desktop

This commit is contained in:
Tw93
2023-03-12 16:17:45 +08:00
parent e3176225a9
commit d7d7e3e522
2 changed files with 4 additions and 4 deletions

View File

@@ -26,7 +26,7 @@ use wry::application::window::Icon;
#[cfg(any(target_os = "linux", target_os = "windows"))]
use wry::webview::WebContext;
use dirs::download_dir;
use dirs::desktop_dir;
use std::path::PathBuf;
enum UserEvent {
@@ -147,7 +147,7 @@ fn main() -> wry::Result<()> {
let download_started = {
let proxy = proxy.clone();
move |uri: String, default_path: &mut PathBuf| {
let path = download_dir()
let path = desktop_dir()
.unwrap()
.join(default_path.display().to_string())
.as_path()
@@ -243,7 +243,7 @@ fn main() -> wry::Result<()> {
Event::UserEvent(UserEvent::DownloadComplete(_, success)) => {
println!("Succeeded: {success}");
if success {
let _ = webview.evaluate_script("window.pakeToast('Save in downloads folder')");
let _ = webview.evaluate_script("window.pakeToast('已保存到桌面~')");
} else {
println!("No output path")
}