From d34930c8bc84727d82cc087e33da15730157174c Mon Sep 17 00:00:00 2001 From: wangchao <1398269744@qq.com> Date: Thu, 30 Apr 2026 15:16:06 +0800 Subject: [PATCH] fix log path --- src/apps/desktop/src/lib.rs | 29 ++++--------------- .../config/components/BasicsConfig.tsx | 14 +++++++-- 2 files changed, 17 insertions(+), 26 deletions(-) diff --git a/src/apps/desktop/src/lib.rs b/src/apps/desktop/src/lib.rs index 2eae44307..1b4922f77 100644 --- a/src/apps/desktop/src/lib.rs +++ b/src/apps/desktop/src/lib.rs @@ -217,16 +217,6 @@ pub async fn _run() { } logging::register_runtime_log_state(startup_log_level, session_log_dir.clone()); - { - let candidates = ["mobile-web/dist","mobile-web","dist"]; - let mut found = false; - let path = PathBuf::from("/data/storage/el2/base/files/dist"); - if path.join("index.html").exists() { - log::info!("Found bundled mobile-web at: {}", path.display()); - api::remote_connect_api::set_mobile_web_resource_path(path); - found = true; - } - } for step in startup_timings.steps() { log::debug!( @@ -241,20 +231,13 @@ pub async fn _run() { // so the primary candidate is "mobile-web/dist". Additional fallbacks // handle legacy or non-standard bundle layouts. { - let candidates = ["mobile-web/dist", "mobile-web", "dist"]; + let candidates = ["mobile-web/dist","mobile-web","dist"]; let mut found = false; - for candidate in &candidates { - if let Ok(p) = app - .path() - .resolve(candidate, tauri::path::BaseDirectory::Resource) - { - if p.join("index.html").exists() { - log::info!("Found bundled mobile-web at: {}", p.display()); - api::remote_connect_api::set_mobile_web_resource_path(p); - found = true; - break; - } - } + let path = PathBuf::from("/data/storage/el2/base/files/dist"); + if path.join("index.html").exists() { + log::info!("Found bundled mobile-web at: {}", path.display()); + api::remote_connect_api::set_mobile_web_resource_path(path); + found = true; } if !found { // Last resort: scan the resource root for any index.html diff --git a/src/web-ui/src/infrastructure/config/components/BasicsConfig.tsx b/src/web-ui/src/infrastructure/config/components/BasicsConfig.tsx index 866551b93..d0d72156d 100644 --- a/src/web-ui/src/infrastructure/config/components/BasicsConfig.tsx +++ b/src/web-ui/src/infrastructure/config/components/BasicsConfig.tsx @@ -263,6 +263,14 @@ function BasicsLoggingSection() { const [openingFolder, setOpeningFolder] = useState(false); const [message, setMessage] = useState<{ type: 'success' | 'error' | 'info'; text: string } | null>(null); + const getFormattedLogPath = useCallback(() => { + if (!runtimeInfo?.sessionLogDir) return ''; + return runtimeInfo.sessionLogDir.replace( + '/data/storage/el2/base/files/bitfun', + '/storage/Users/currentUser/appdata/el2/base/com.huawei.bitfunide/files/bitfun' + ); + }, [runtimeInfo?.sessionLogDir]); + const levelOptions = useMemo( () => [ { value: 'trace', label: t('logging.levels.trace') }, @@ -329,7 +337,7 @@ function BasicsLoggingSection() { ); const handleOpenFolder = useCallback(async () => { - const folder = runtimeInfo?.sessionLogDir; + const folder = getFormattedLogPath(); if (!folder) { showMessage('error', t('logging.messages.pathUnavailable')); return; @@ -344,7 +352,7 @@ function BasicsLoggingSection() { } finally { setOpeningFolder(false); } - }, [runtimeInfo?.sessionLogDir, showMessage, t]); + }, [getFormattedLogPath, showMessage, t]); if (loading) { return ; @@ -380,7 +388,7 @@ function BasicsLoggingSection() { >
- {runtimeInfo?.sessionLogDir || '-'} + {getFormattedLogPath() || '-'}