build: make it compile under linux

This commit is contained in:
鲁树人 2023-12-28 21:53:38 +00:00
parent 3421d5f134
commit f1cd248ad3

View File

@ -5,15 +5,16 @@ use std::fs::File;
use std::io::{BufReader, Read}; use std::io::{BufReader, Read};
use std::io::{Cursor, Seek}; use std::io::{Cursor, Seek};
use std::path::Path; use std::path::Path;
#[cfg(target_os = "windows")]
use tao::platform::windows::WindowBuilderExtWindows; use tao::platform::windows::WindowBuilderExtWindows;
use tao::window::Icon;
use tao::{ use tao::{
event::{Event, WindowEvent}, event::{Event, WindowEvent},
event_loop::{ControlFlow, EventLoop}, event_loop::{ControlFlow, EventLoop},
window::WindowBuilder, window::{Icon, WindowBuilder},
}; };
use wry::WebContext; use wry::{http::header::CONTENT_TYPE, WebContext, WebViewBuilder};
use wry::{http::header::CONTENT_TYPE, WebViewBuilder};
use zip::ZipArchive; use zip::ZipArchive;
static APP_UUID: &str = "39abaebb-57b1-4c12-ab88-321fd7a93354"; static APP_UUID: &str = "39abaebb-57b1-4c12-ab88-321fd7a93354";
@ -86,11 +87,15 @@ fn main() -> wry::Result<()> {
let event_loop = EventLoop::new(); let event_loop = EventLoop::new();
let window = WindowBuilder::new() let window = WindowBuilder::new()
.with_title(format!("um-react-wry 桌面客户端 - {}", version_suffix)) .with_title(format!("um-react-wry 桌面客户端 - {}", version_suffix))
.with_maximized(true) .with_maximized(true);
.with_window_icon(Some(load_icon(include_bytes!("um-react@16.webp"))))
.with_taskbar_icon(Some(load_icon(include_bytes!("um-react@192.webp")))) #[cfg(target_os = "windows")]
.build(&event_loop) let window = window.with_taskbar_icon(Some(load_icon(include_bytes!("um-react@192.webp"))));
.unwrap();
let window = window.build(&event_loop).unwrap();
#[cfg(any(target_os = "windows", target_os = "linux"))]
window.set_window_icon(Some(load_icon(include_bytes!("um-react@16.webp"))));
#[cfg(any( #[cfg(any(
target_os = "windows", target_os = "windows",