custom.txt and tray for mac
This commit is contained in:
parent
770289cd67
commit
ef27cd6c5c
@ -1482,12 +1482,13 @@ pub fn load_custom_client() {
|
|||||||
read_custom_client(data.trim());
|
read_custom_client(data.trim());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let Ok(cmd) = std::env::current_exe() else {
|
let Some(path) = std::env::current_exe().map_or(None, |x| x.parent().map(|x| x.to_path_buf()))
|
||||||
return;
|
else {
|
||||||
};
|
|
||||||
let Some(path) = cmd.parent().map(|x| x.join("custom.txt")) else {
|
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
#[cfg(target_os = "macos")]
|
||||||
|
let path = path.join("../Resources");
|
||||||
|
let path = path.join("custom.txt");
|
||||||
if path.is_file() {
|
if path.is_file() {
|
||||||
let Ok(data) = std::fs::read_to_string(&path) else {
|
let Ok(data) = std::fs::read_to_string(&path) else {
|
||||||
log::error!("Failed to read custom client config");
|
log::error!("Failed to read custom client config");
|
||||||
|
18
src/tray.rs
18
src/tray.rs
@ -205,15 +205,17 @@ async fn start_query_session_count(sender: std::sync::mpsc::Sender<Data>) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn load_icon_from_asset() -> Option<image::DynamicImage> {
|
fn load_icon_from_asset() -> Option<image::DynamicImage> {
|
||||||
|
let Some(path) = std::env::current_exe().map_or(None, |x| x.parent().map(|x| x.to_path_buf()))
|
||||||
|
else {
|
||||||
|
return None;
|
||||||
|
};
|
||||||
|
#[cfg(target_os = "macos")]
|
||||||
|
let path = path.join("../Resources/AppIcon.icns");
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
if let Ok(cmd) = std::env::current_exe() {
|
let path = path.join(r"data\flutter_assets\assets\icon.png");
|
||||||
let path = r".\data\flutter_assets\assets\icon.png";
|
if path.exists() {
|
||||||
if let Some(path) = cmd.parent().map(|x| x.join(path)) {
|
if let Ok(image) = image::open(path) {
|
||||||
if path.exists() {
|
return Some(image);
|
||||||
if let Ok(image) = image::open(path) {
|
|
||||||
return Some(image);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
None
|
None
|
||||||
|
Loading…
x
Reference in New Issue
Block a user