quick support if right click && run as admin on win
Signed-off-by: 21pages <pages21@163.com>
This commit is contained in:
		
							parent
							
								
									6e36aa8c56
								
							
						
					
					
						commit
						7c2d7df62e
					
				| @ -54,11 +54,6 @@ pub fn core_main() -> Option<Vec<String>> { | |||||||
|         return core_main_invoke_new_connection(std::env::args()); |         return core_main_invoke_new_connection(std::env::args()); | ||||||
|     } |     } | ||||||
|     let click_setup = cfg!(windows) && args.is_empty() && crate::common::is_setup(&arg_exe); |     let click_setup = cfg!(windows) && args.is_empty() && crate::common::is_setup(&arg_exe); | ||||||
|     #[cfg(not(feature = "flutter"))] |  | ||||||
|     { |  | ||||||
|         _is_quick_support = |  | ||||||
|             cfg!(windows) && args.is_empty() && arg_exe.to_lowercase().ends_with("qs.exe"); |  | ||||||
|     } |  | ||||||
|     if click_setup { |     if click_setup { | ||||||
|         args.push("--install".to_owned()); |         args.push("--install".to_owned()); | ||||||
|         flutter_args.push("--install".to_string()); |         flutter_args.push("--install".to_string()); | ||||||
| @ -70,6 +65,14 @@ pub fn core_main() -> Option<Vec<String>> { | |||||||
|         println!("{}", crate::VERSION); |         println!("{}", crate::VERSION); | ||||||
|         return None; |         return None; | ||||||
|     } |     } | ||||||
|  |     #[cfg(windows)] | ||||||
|  |     { | ||||||
|  |         _is_quick_support |= !crate::platform::is_installed() | ||||||
|  |             && args.is_empty() | ||||||
|  |             && (arg_exe.to_lowercase().ends_with("qs.exe") | ||||||
|  |                 || (!click_setup && crate::platform::is_elevated(None).unwrap_or(false))); | ||||||
|  |         crate::portable_service::client::set_quick_support(_is_quick_support); | ||||||
|  |     } | ||||||
|     #[cfg(debug_assertions)] |     #[cfg(debug_assertions)] | ||||||
|     { |     { | ||||||
|         use hbb_common::env_logger::*; |         use hbb_common::env_logger::*; | ||||||
|  | |||||||
| @ -459,6 +459,7 @@ pub mod client { | |||||||
|         static ref RUNNING: Arc<Mutex<bool>> = Default::default(); |         static ref RUNNING: Arc<Mutex<bool>> = Default::default(); | ||||||
|         static ref SHMEM: Arc<Mutex<Option<SharedMemory>>> = Default::default(); |         static ref SHMEM: Arc<Mutex<Option<SharedMemory>>> = Default::default(); | ||||||
|         static ref SENDER : Mutex<mpsc::UnboundedSender<ipc::Data>> = Mutex::new(client::start_ipc_server()); |         static ref SENDER : Mutex<mpsc::UnboundedSender<ipc::Data>> = Mutex::new(client::start_ipc_server()); | ||||||
|  |         static ref QUICK_SUPPORT: Arc<Mutex<bool>> = Default::default(); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     pub enum StartPara { |     pub enum StartPara { | ||||||
| @ -561,6 +562,10 @@ pub mod client { | |||||||
|         *SHMEM.lock().unwrap() = None; |         *SHMEM.lock().unwrap() = None; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     pub fn set_quick_support(v: bool) { | ||||||
|  |         *QUICK_SUPPORT.lock().unwrap() = v; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     fn set_dir_permission(dir: &PathBuf) -> bool { |     fn set_dir_permission(dir: &PathBuf) -> bool { | ||||||
|         // // give Everyone RX permission
 |         // // give Everyone RX permission
 | ||||||
|         std::process::Command::new("icacls") |         std::process::Command::new("icacls") | ||||||
| @ -685,17 +690,7 @@ pub mod client { | |||||||
|         use DataPortableService::*; |         use DataPortableService::*; | ||||||
|         let rx = Arc::new(tokio::sync::Mutex::new(rx)); |         let rx = Arc::new(tokio::sync::Mutex::new(rx)); | ||||||
|         let postfix = IPC_SUFFIX; |         let postfix = IPC_SUFFIX; | ||||||
|         #[cfg(feature = "flutter")] |         let quick_support = QUICK_SUPPORT.lock().unwrap().clone(); | ||||||
|         let quick_support = { |  | ||||||
|             let args: Vec<_> = std::env::args().collect(); |  | ||||||
|             args.contains(&"--quick_support".to_string()) |  | ||||||
|         }; |  | ||||||
|         #[cfg(not(feature = "flutter"))] |  | ||||||
|         let quick_support = std::env::current_exe() |  | ||||||
|             .unwrap_or("".into()) |  | ||||||
|             .to_string_lossy() |  | ||||||
|             .to_lowercase() |  | ||||||
|             .ends_with("qs.exe"); |  | ||||||
| 
 | 
 | ||||||
|         match new_listener(postfix).await { |         match new_listener(postfix).await { | ||||||
|             Ok(mut incoming) => loop { |             Ok(mut incoming) => loop { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user