fix: clear logs should not delete the folder (#4806)

This commit is contained in:
Louis 2025-03-13 23:49:35 +08:00 committed by GitHub
parent 74f6682263
commit 39e5649454
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 7 deletions

View File

@ -1 +1 @@
1.0.11-rc8
1.0.11-rc9

View File

@ -7,19 +7,15 @@ import {
ArrowLeftIcon,
DownloadIcon,
FileJson,
RefreshCwIcon,
SettingsIcon,
} from 'lucide-react'
import Spinner from '@/containers/Loader/Spinner'
import ModelDownloadButton from '@/containers/ModelDownloadButton'
import ModelLabel from '@/containers/ModelLabel'
import { MainViewState } from '@/constants/screens'
import { useRefreshModelList } from '@/hooks/useEngineManagement'
import { MarkdownTextMessage } from '@/screens/Thread/ThreadCenterPanel/TextMessage/MarkdownTextMessage'
import { toGigabytes } from '@/utils/converter'

View File

@ -1,4 +1,4 @@
import { fs } from '@janhq/core'
import { fs, joinPath } from '@janhq/core'
import { Button, Input, ScrollArea, Switch } from '@janhq/joi'
import { useAtom, useAtomValue } from 'jotai'
import { FolderOpenIcon } from 'lucide-react'
@ -22,7 +22,9 @@ const Privacy = () => {
*/
const clearLogs = async () => {
try {
await fs.rm(`file://logs`)
for (const file of await fs.readdirSync(`file://logs`)) {
await fs.rm(await joinPath(['file://logs', file]))
}
} catch (err) {
console.error('Error clearing logs: ', err)
}