✨ Save to Desktop
This commit is contained in:
@@ -26,7 +26,7 @@ use wry::application::window::Icon;
|
|||||||
#[cfg(any(target_os = "linux", target_os = "windows"))]
|
#[cfg(any(target_os = "linux", target_os = "windows"))]
|
||||||
use wry::webview::WebContext;
|
use wry::webview::WebContext;
|
||||||
|
|
||||||
use dirs::download_dir;
|
use dirs::desktop_dir;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
enum UserEvent {
|
enum UserEvent {
|
||||||
@@ -147,7 +147,7 @@ fn main() -> wry::Result<()> {
|
|||||||
let download_started = {
|
let download_started = {
|
||||||
let proxy = proxy.clone();
|
let proxy = proxy.clone();
|
||||||
move |uri: String, default_path: &mut PathBuf| {
|
move |uri: String, default_path: &mut PathBuf| {
|
||||||
let path = download_dir()
|
let path = desktop_dir()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.join(default_path.display().to_string())
|
.join(default_path.display().to_string())
|
||||||
.as_path()
|
.as_path()
|
||||||
@@ -243,7 +243,7 @@ fn main() -> wry::Result<()> {
|
|||||||
Event::UserEvent(UserEvent::DownloadComplete(_, success)) => {
|
Event::UserEvent(UserEvent::DownloadComplete(_, success)) => {
|
||||||
println!("Succeeded: {success}");
|
println!("Succeeded: {success}");
|
||||||
if success {
|
if success {
|
||||||
let _ = webview.evaluate_script("window.pakeToast('Save in downloads folder')");
|
let _ = webview.evaluate_script("window.pakeToast('已保存到桌面~')");
|
||||||
} else {
|
} else {
|
||||||
println!("No output path")
|
println!("No output path")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
"tauri": {
|
"tauri": {
|
||||||
"windows": [
|
"windows": [
|
||||||
{
|
{
|
||||||
"url": "https://weread.qq.com/",
|
"url": "https://github.com/tw93/Pake/releases/tag/V1.0.6",
|
||||||
"transparent": true,
|
"transparent": true,
|
||||||
"fullscreen": false,
|
"fullscreen": false,
|
||||||
"width": 1200,
|
"width": 1200,
|
||||||
|
|||||||
Reference in New Issue
Block a user