chore: add macos startup todo

This commit is contained in:
GyDi 2022-01-11 23:14:43 +08:00
parent 43c63ffa70
commit 8f5b2b4a0e

View File

@ -3,9 +3,9 @@ use std::path::PathBuf;
static APP_KEY: &str = "ClashVerge"; static APP_KEY: &str = "ClashVerge";
#[cfg(target_os = "windows")]
/// get the startup value /// get the startup value
/// whether as same as the exe_path /// whether as same as the exe_path
#[cfg(target_os = "windows")]
pub fn get_startup(exe_path: &PathBuf) -> io::Result<bool> { pub fn get_startup(exe_path: &PathBuf) -> io::Result<bool> {
use winreg::enums::*; use winreg::enums::*;
use winreg::RegKey; use winreg::RegKey;
@ -26,9 +26,9 @@ pub fn get_startup(exe_path: &PathBuf) -> io::Result<bool> {
} }
} }
#[cfg(target_os = "windows")]
/// set the startup on windows /// set the startup on windows
/// delete the reg key if disabled /// delete the reg key if disabled
#[cfg(target_os = "windows")]
pub fn set_startup(enable: bool, exe_path: &PathBuf) -> io::Result<()> { pub fn set_startup(enable: bool, exe_path: &PathBuf) -> io::Result<()> {
use winreg::enums::*; use winreg::enums::*;
use winreg::RegKey; use winreg::RegKey;
@ -49,6 +49,18 @@ pub fn set_startup(enable: bool, exe_path: &PathBuf) -> io::Result<()> {
} }
} }
/// todo
#[cfg(target_os = "macos")]
pub fn get_startup(exe_path: &PathBuf) -> io::Result<bool> {
Ok(true)
}
/// todo
#[cfg(target_os = "macos")]
pub fn set_startup(enable: bool, exe_path: &PathBuf) -> io::Result<()> {
Ok(())
}
#[cfg(target_os = "windows")] #[cfg(target_os = "windows")]
#[test] #[test]
fn test() { fn test() {