修复已知问题
This commit is contained in:
+12
-17
@@ -146,25 +146,20 @@ fn main() {
|
|||||||
|
|
||||||
#[cfg(any(target_os = "linux", target_os = "macos"))]
|
#[cfg(any(target_os = "linux", target_os = "macos"))]
|
||||||
fn main() {
|
fn main() {
|
||||||
|
if sudo::RunningAs::Root != sudo::check() {
|
||||||
|
println!(
|
||||||
|
"{}",
|
||||||
|
style("需要使用root权限执行(Need to execute with root permission)...").red()
|
||||||
|
);
|
||||||
|
sudo::escalate_if_needed().unwrap();
|
||||||
|
}
|
||||||
let args = BaseArgs::parse();
|
let args = BaseArgs::parse();
|
||||||
match args.command {
|
let home = dirs::home_dir().unwrap().join(".switch_desktop");
|
||||||
Commands::Start(_) | Commands::Stop => {
|
config::set_home(home);
|
||||||
if sudo::RunningAs::Root != sudo::check() {
|
if let Commands::Start(start_args) = &args.command {
|
||||||
println!(
|
if start_args.log {
|
||||||
"{}",
|
let _ = log_init();
|
||||||
style("需要使用root权限执行(Need to execute with root permission)...").red()
|
|
||||||
);
|
|
||||||
sudo::escalate_if_needed().unwrap();
|
|
||||||
}
|
|
||||||
let home = dirs::home_dir().unwrap().join(".switch_desktop");
|
|
||||||
config::set_home(home);
|
|
||||||
if let Commands::Start(start_args) = &args.command {
|
|
||||||
if start_args.log {
|
|
||||||
let _ = log_init();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
_ => {}
|
|
||||||
}
|
}
|
||||||
unix::main0(args);
|
unix::main0(args);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user