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,6 +1,6 @@
import { app } from 'electron'
import fs from 'fs'
import path from 'path'
import { getPathFallback } from './electronRuntime'
export interface ExportRecord {
exportTime: number
@@ -20,7 +20,7 @@ class ExportRecordService {
private resolveFilePath(): string {
if (this.filePath) return this.filePath
const workerUserDataPath = String(process.env.WEFLOW_USER_DATA_PATH || process.env.WEFLOW_CONFIG_CWD || '').trim()
const userDataPath = workerUserDataPath || app?.getPath?.('userData') || process.cwd()
const userDataPath = workerUserDataPath || getPathFallback('userData')
fs.mkdirSync(userDataPath, { recursive: true })
this.filePath = path.join(userDataPath, 'weflow-export-records.json')
return this.filePath