Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 6 additions & 23 deletions src/apps/desktop/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!(
Expand All @@ -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
Expand Down
14 changes: 11 additions & 3 deletions src/web-ui/src/infrastructure/config/components/BasicsConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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') },
Expand Down Expand Up @@ -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;
Expand All @@ -344,7 +352,7 @@ function BasicsLoggingSection() {
} finally {
setOpeningFolder(false);
}
}, [runtimeInfo?.sessionLogDir, showMessage, t]);
}, [getFormattedLogPath, showMessage, t]);

if (loading) {
return <ConfigPageLoading text={t('logging.messages.loading')} />;
Expand Down Expand Up @@ -380,7 +388,7 @@ function BasicsLoggingSection() {
>
<div className="bitfun-logging-config__path-row">
<div className="bitfun-logging-config__path-box">
{runtimeInfo?.sessionLogDir || '-'}
{getFormattedLogPath() || '-'}
</div>
<Tooltip content={t('logging.actions.openFolderTooltip')} placement="top">
<button
Expand Down
Loading