fix: support service runtime fallbacks

This commit is contained in:
cc
2026-04-27 23:08:39 +08:00
parent 338d0e2f20
commit 7469337aeb
9 changed files with 195 additions and 58 deletions

View File

@@ -1,9 +1,9 @@
import { join } from 'path'
import { existsSync, readdirSync, statSync, readFileSync, appendFileSync, mkdirSync } from 'fs'
import { pathToFileURL } from 'url'
import { app } from 'electron'
import { ConfigService } from './config'
import { wcdbService } from './wcdbService'
import { getPathFallback } from './electronRuntime'
export interface VideoInfo {
videoUrl?: string // 视频文件路径(用于 readFile
@@ -45,7 +45,7 @@ class VideoService {
try {
const timestamp = new Date().toISOString()
const metaStr = meta ? ` ${JSON.stringify(meta)}` : ''
const logDir = join(app.getPath('userData'), 'logs')
const logDir = join(getPathFallback('userData'), 'logs')
if (!existsSync(logDir)) mkdirSync(logDir, { recursive: true })
appendFileSync(join(logDir, 'wcdb.log'), `[${timestamp}] [VideoService] ${message}${metaStr}\n`, 'utf8')
} catch { }