fix(mobile): logs unreachable on android (#1710)

This commit is contained in:
狂男风
2025-12-27 20:04:18 +08:00
committed by GitHub
parent ca9b4c58b1
commit 37531507db
2 changed files with 33 additions and 5 deletions
+9 -4
View File
@@ -2,7 +2,7 @@
import { type } from '@tauri-apps/plugin-os'
import { appLogDir } from '@tauri-apps/api/path'
import { invoke } from '@tauri-apps/api/core'
import { writeText } from '@tauri-apps/plugin-clipboard-manager'
import { exit } from '@tauri-apps/plugin-process'
import { I18nUtils, RemoteManagement, Utils } from "easytier-frontend-lib"
@@ -231,6 +231,11 @@ onMounted(async () => {
let current_log_level = 'off'
const log_menu = ref()
// 从后端获取正确的日志路径
async function getLogDirPath(): Promise<string> {
return await invoke<string>('get_log_dir_path')
}
const log_menu_items_popup: Ref<MenuItem[]> = ref([
...['off', 'warn', 'info', 'debug', 'trace'].map(level => ({
label: () => t(`logging_level_${level}`) + (current_log_level === level ? ' ✓' : ''),
@@ -246,15 +251,15 @@ const log_menu_items_popup: Ref<MenuItem[]> = ref([
label: () => t('logging_open_dir'),
icon: 'pi pi-folder-open',
command: async () => {
// console.log('open log dir', await appLogDir())
await open(await appLogDir())
// console.log('open log dir', await getLogDirPath())
await open(await getLogDirPath())
},
},
{
label: () => t('logging_copy_dir'),
icon: 'pi pi-tablet',
command: async () => {
await writeText(await appLogDir())
await writeText(await getLogDirPath())
},
},
])