From e7f2571469843de3b347c344697413a03c745651 Mon Sep 17 00:00:00 2001 From: lubeilin <1791778603@qq.com> Date: Mon, 4 Mar 2024 21:13:05 +0800 Subject: [PATCH] =?UTF-8?q?[mio]=20device=5Fid=E8=8E=B7=E5=8F=96=E4=B8=8D?= =?UTF-8?q?=E5=88=B0=E6=97=B6=E9=BB=98=E8=AE=A4=E5=80=BC=E5=8F=96=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vnt-cli/src/config/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vnt-cli/src/config/mod.rs b/vnt-cli/src/config/mod.rs index d43ace2..a2c733f 100644 --- a/vnt-cli/src/config/mod.rs +++ b/vnt-cli/src/config/mod.rs @@ -175,17 +175,17 @@ pub fn get_device_id() -> String { if let Some(id) = common::identifier::get_unique_identifier() { id } else { - let id = uuid::Uuid::new_v4().to_string(); let path_buf = match crate::app_home() { Ok(path_buf) => path_buf.join("device-id"), Err(e) => { log::warn!("{:?}", e); - return id; + return String::new(); } }; if let Ok(id) = std::fs::read_to_string(path_buf.as_path()) { id } else { + let id = uuid::Uuid::new_v4().to_string(); let _ = std::fs::write(path_buf, &id); id }