[mio] fmt
This commit is contained in:
@@ -177,11 +177,9 @@ pub fn get_device_id() -> String {
|
|||||||
} else {
|
} else {
|
||||||
let id = uuid::Uuid::new_v4().to_string();
|
let id = uuid::Uuid::new_v4().to_string();
|
||||||
let path_buf = match crate::app_home() {
|
let path_buf = match crate::app_home() {
|
||||||
Ok(path_buf) => {
|
Ok(path_buf) => path_buf.join("device-id"),
|
||||||
path_buf.join("device-id")
|
|
||||||
}
|
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
log::warn!("{:?}",e);
|
log::warn!("{:?}", e);
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
+12
-2
@@ -19,7 +19,11 @@ mod root_check;
|
|||||||
|
|
||||||
pub fn app_home() -> io::Result<PathBuf> {
|
pub fn app_home() -> io::Result<PathBuf> {
|
||||||
let path = std::env::current_exe()?
|
let path = std::env::current_exe()?
|
||||||
.parent().ok_or(io::Error::new(io::ErrorKind::Other,"current_exe parent error"))?
|
.parent()
|
||||||
|
.ok_or(io::Error::new(
|
||||||
|
io::ErrorKind::Other,
|
||||||
|
"current_exe parent error",
|
||||||
|
))?
|
||||||
.join("env");
|
.join("env");
|
||||||
if !path.exists() {
|
if !path.exists() {
|
||||||
std::fs::create_dir_all(&path)?;
|
std::fs::create_dir_all(&path)?;
|
||||||
@@ -56,7 +60,12 @@ fn main() {
|
|||||||
opts.optflag("", "cmd", "开启窗口输入");
|
opts.optflag("", "cmd", "开启窗口输入");
|
||||||
opts.optflag("", "no-proxy", "关闭内置代理");
|
opts.optflag("", "no-proxy", "关闭内置代理");
|
||||||
opts.optflag("", "first-latency", "优先延迟");
|
opts.optflag("", "first-latency", "优先延迟");
|
||||||
opts.optflag("", "use-channel", "使用通道 relay/p2p,默认两者都使用");
|
opts.optopt(
|
||||||
|
"",
|
||||||
|
"use-channel",
|
||||||
|
"使用通道 relay/p2p,默认两者都使用",
|
||||||
|
"<use-channel>",
|
||||||
|
);
|
||||||
opts.optopt("f", "", "配置文件", "<conf>");
|
opts.optopt("f", "", "配置文件", "<conf>");
|
||||||
//"后台运行时,查看其他设备列表"
|
//"后台运行时,查看其他设备列表"
|
||||||
opts.optflag("", "list", "后台运行时,查看其他设备列表");
|
opts.optflag("", "list", "后台运行时,查看其他设备列表");
|
||||||
@@ -261,6 +270,7 @@ fn main() {
|
|||||||
.opt_get::<UseChannelType>("use-channel")
|
.opt_get::<UseChannelType>("use-channel")
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.unwrap_or_else(|| {
|
.unwrap_or_else(|| {
|
||||||
|
println!("use_channel_type 111 {:?}", UseChannelType::All);
|
||||||
if relay {
|
if relay {
|
||||||
UseChannelType::Relay
|
UseChannelType::Relay
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user